I compared the Sharp IR Distance Sensor (4-30cm) and the Ultrasonic HC-SR04. It is night and day difference!
I used the ultrasonic before for an old dance sword hobby project. It's annoying to program for because you have to write code for the trig and echo pins. The ultrasonic is also not as reliable. I find the when I put my hand in front of it, it doesn't register it as easily as something with a larger surface area. It jumps back down to 0 a lot when it misses my hand. Even when it is catching it, the data jumps around a little too.
The Sharp is beautiful! It's so simple to program for. When I map its data to a slider, it feels like when I move my hand up and down, it is exact! It very easily and effortlessly tracks my hand gestures. The IR sensor also works through transparent and translucent plastic. Although, the less transparent it is, the more jittery the data. As expected it works in the dark.
Now that I compared them, the only reason why I would use an ultrasonic instead of an IR is if I'm on an extremely tight budget, or I want to track whole bodies at much farther distances. But even then, there are more expensive Sharp IR sensors that have a farther distance threshold. The problem with those is that you completely lose the short distance range. For example, there is one that's range is from 20cm-150cm; close range is lost.
I also have a Time of Flight sensor, Hall Effect sensors, and an IR Emitter/Receiver that I would like to test out. But for now, goodnight....
If you are looking for a summary for my Masters thesis, it is here.