Sensor to measure the distance
If you're talking about a finger, and you need distance and not position, you might try a capacitive proximity sensor, like that used in a Theremin.

See the pdf at http://www.cypress.com/file/95206/download for some background