Why sound wave is the best choice for many location detectors?
Basically, sound is slow.

Using sound you can easily time how long a wave takes to travel to your object and reflect off it, thus giving you a fairly accurate distance.  Light goes too fast for that, unless you are looking to measure the distance of the moon, say.

And why ultrasonic? So you can't year it. Imagine how annoying it would be if you were forced to hear it all the time?  BeeeEEEeeeEEEEeeeEEEEEEEeeeeeeEEE....eeEEEeeEEEP