To make a simple proximity sensor, all you need is a light emitter and a light detector. The light emitter is constantly on. Whenever that light hits a nearby object, some of the light is reflected back to the detector. The closer the object is, the more light will be reflected. By measuring the output of the light detector, you can get a rough approximation of how close the object is.
These projects will show you how to make your own simple IR sensors along with some tutorials for incorporating these sensors into actual devices.