The VCNL4040 is a handy two-in-one sensor, with a proximity sensor that works from 0 to 200mm and light sensor with range of 0.0125 to 6553 lux.
When you need to measure a small distance with reasonable accuracy, the VCNL4040 Proximity Sensor from Vishay can do that for you. To give you some ability to tune your measurements for your situation, the VCNL4040 lets you adjust the integration time (how long light is being measured) to set the sensitivity of your measurements depending on the lighting conditions.
Sparkfun has written an Arduino library to flex every feature of this sensor.
More information can be found on the website of Sparkfun.