Sensors are a robot's eyes, ears and sense of touch. They turn something in the world, such as distance, light or pressure, into a number the robot's program can use.
Ultrasonic distance sensor: it sends out a short burst of sound too high for people to hear and listens for the echo. The longer the echo takes to return, the farther away the object is. This is how many robots avoid walls.
Line-tracking sensor: it shines a small light at the floor and measures how much bounces back. A light floor reflects a lot; a dark line reflects very little. Two or three of these side by side let a robot tell whether the line is to its left or right.
Touch switch: the simplest sensor of all. It reports pressed or not pressed, which is useful as a bumper.
Every sensor has limits. Ultrasonic sensors struggle with soft or angled surfaces, and line sensors can be confused by shiny floors or strong sunlight. Good robot builders test their sensors in the real place the robot will work.
Try it: connect the distance sensor to your board, print its readings, and move your hand closer and farther away. How do the numbers change?