The usual way is to modulate an IR beam with a sine wave and compare the phase of the modulation between transmitting and receiving.
Another way is from triangulation. The IR sender and receiver are spaced on a baseline and the transmitter and receiver can be turned in angle. They are done so that the reflected beam is picked up by the receiver.