The TCRT5000L Infrared Reflective Sensors are great for detecting lines and edges. They can also be used to for close range obstacle detection. These sensors transmit an IR infrared beam and then measure the reflection. They work best when the measuring a surface that is a few centimeters away. The robots microcontroller brain reads the value of reflectance to decide how to proceed. A table edge can be detected when reflections from a table suddenly stop. Similarly, a black line drawn on a white surface can be detected when the reflection is absorbed by the black colored line instead of being reflected by the white colored surface. Close obstacles can be detected by the presence of some reflection. Of course, the success of reflective sensors depends greatly on the surfaces being detected. Overall, these sensors are great for edge detection and line following. For obstacle detection, you might want to use these in conjunction with other sensors, such as ultrasonic distance sensors, for a more robust solution.
Datasheet: TCRT5000L