Other: Cost and distance*. Why the asterisk? When I think of reflective sensors, I think of entry sensors and garage door safety circuits. The distance (range) can be 3 feet for a personnel door up to 32 feet for a larger commercial garage door. One size fits most. Align the reflector back at the transceiver and you're up and running. To quote Ron Popeil, "Set it and forget it." The few ultrasonic sensors I've played with needed to be adjusted to respond correctly to the material being sensed.
This is a simple question but the answer as always depends on many factors. The environment that you are operating in will influence your decision. Also cost can be a factor in you decision where ultrasonic sensor cost can cost about 100 times more that optical sensors.
There isn't a single right answer here. I was about to vote for "distance is over 9 m" but then I thought of depth sounders, which both work under water and can sense over much greater distances than 9m. I don't know of any optical depth sounders !
"Response speed must be fast" is the other possible, but how fast is fast ?
Top Comments