This paper proposes a new technique for computing the distance to an unknown planar surface and, at the same time, estimating the material of the surface through the use of low-cost infrared sensors. Previous approaches to this problem require more costly ultrasound systems as a complement or, alternatively, an exhaustive training process that records the sensor response corresponding to known materials measured at different predefined distances. Experimental results with an off-the-shelf infrared sensor mounted on a mobile robot are presented.