You might find useful to use an infrared proximity sensor. They can cover a distance from 10cm to 80cm. Other option would be the ultrasonic distance sensors. You can find forum discussions about this topic easily, for example this one: SparkFun Electronics • View topic - High Accuracy distance sensor?. I suggest you to read it, you might find something useful for your project in there.