Hmmm - YES.
The IR sensor doesn't know what its being used for: following something, avoiding something, or being mounted on a refrigerator door to turn off the light once the door is shut. There are software libraries available to make it easier for you to talk to the sensor - but what your robot then does with the answer is up to it. Thats the beauty of it!