Most of the reflective sensors in the market use either red or near IR wavelength and have a very short range (in the range of mm).
IR (really NIR) is commonly used because it is cheap and people will not notice the light, which could be annoying if it were visible. Range is not limited to millimeter however. I have NIR room sensors that are quite effective at 10m range, and people have measured the distance to the moon (385,000 km) using NIR lasers. Optics, not wavelength, determine the effective range.
How does the distance between the sensor and the sensing object be taken as a factor in selection of wavelength?
More power will give you longer range, but optical power is limited by safety. Using NIR (or better, IR) wavelengths will enable you to use more power while remaining eye-safe.
Edit
Using IR wavelengths absolutely does allow you to use more power while remaining eye-safe. There are two reasons for this. First, photochemical effects only happen at visible wavelengths and below (and so an entire damage mechanism does not occur in the IR). Second, the absorption of light by the retina and the transmission of light by the vitreous humor both decrease as you move from the visible to IR spectrum. Hence more IR power must be applied to have the same dosage absorbed by the retina. I'll go through and address the replies individually.
-1 for claiming that using an a non-visible wavelength at higher power is just as safe as a visible wavelength at lower or equal power.
The ANSI Z136.1 specification defines maximum permissible exposure powers as a function of wavelength and exposure time:

Moving from the visible to 1050nm for example, the MPE increases by a factor of 5 for short (thermally-limited) exposure, to up to a factor of 50 for long (photo-chemical limited) exposure. 50 times more power is a huge difference in eye safety. There are no IR wavelengths where the exposure is lower than visible, so IR will always allow more power while remaining eye safe.
Visible light actually can have higher limits for eye safety, because the aversion response (you won't keep staring at a visible source like you might with an IR source) is taken into account.
According to Z136.1, eye safe refers to class 1 devices (see Appendix H), so the aversion response is not considered when determining if a device is eye safe. Instead, you use the MPE directly, and you get that the exposure limit is lower in the visible.
This makes sense. The purpose of the exposure limit is to figure out if a device can cause injury. The aversion response can mitigate injury if a non-eye safe source is briefly viewed, but you first need to figure out if the device is capable of causing injury before that matters.