Yep, the sensor bar only exists for that, really.
The distance the "camera" in the tip of the Wiimote sees between the two LEDs on the sensor bar tells the Wii how far the Wiimote is from the sensor. That's why certain light sources could confuse the Wiimote.
If the Wiimote sees the LEDs close together, it knows the Wiimote is far. If they're further apart, it knows it's nearer.