It all depends of what you are trying to detect and the particular application/environment.
The HC504 is an ultrasonic emiter/receiver perfect for detecting distance to a facing object. There are many other sensors, even combined ones that allow you to detect color and even sense of direction of the detected object...