Yes, you can do that, and LDRs do exists
Its probably the easiest way of making a line-following robot. Wire up the LDR in a voltage divider, and feed it into your microcontroller digital input. The signal will be high or low depending on whether the LDR is on a black or white surface, and depending on how you wire up the voltage divider.
I've also used LDRs to follow a green line on a yellow surface. Its just a bit harder as you will need to read the analogue value instead of digital (unless you carefully design and calibrate the voltage divider).