If you want to measure range with light/IR you need either precision optics (uses angle of reflection and triangulation) or precision and ultra-fast timing circuits (time of flight). You can't really build either yourself.
Just buy an IR sensor from Sharp (that uses angle of reflection). Time-of-fligt sensors are just too expensive (at least $5000 each, easily up to $10k and beyond).
For example, and of the SHarp IR sensors on this page like the GP2D12. Because of they they work however, they do have noticeable minimum ranges and maximum ranges (to get a longer max range you must tolerate a longer minimum range as well unless you use multiple sensors).
Infrared and Light Sensors - RobotShop.ca
But for cheapness and low minimum range with large maximum range, ultrasonic is the way to go on a hobbiest budget:
Ultrasonic Range Finders - RobotShop.ca
All of the aformentioned Sharp sensors models plus more models and most of the aformentioned ultrasonic sensors can also be found here:
Sensors
In case you were wondering...measuring intensity to determine distance tends not to work because it is too dependent on object colour and reflectivity. Plus the light dissipates too much so you have to use lasers or something. Time-of-flight is probably the best, but the hardest to make with since you must time something that travels at the speed of light. That's why sonar is popular- sound travels much slower than electronics work at so it's easy to measure. Otherwise, with light, angular reflection and triangulation tends to be the cheapest method.