There are two main kinds of range sensors, each using a different system.
The triangulation-based system that projects light in a known direction from a known location.
The second system is based on a time-of- flight measurement. It measures the delay between emission and detection of the light reflected by the surface, and thus the accuracy does not deteriorate rapidly as the range increases.