IR Sensors

https://www.aliexpress.com/item-img/10PCS-IR-Infrared-Line-Track-Follower-Sensor-TCRT5000-Obstacle-Avoidanc-For-Arduino/32673376693.html?spm=2114.10010108.1000017.2.3fa4ea0fxLiVAx

I've used these for line following and found them very reliable. It is quite sensitive to the distance from the object. (10mm) But it is very good at recognising black and white objects.