Which proximity sensor to use?
Tomas Sanladerer has produced a nice video on this topic: https://www.youtube.com/watch?v=il9bNWn66BY

@ 7:31 you see an overview of the precision of various sensors, including the ones you mention. It appears that the M12-4 and M18-8 sensors are more accurate than the M8-8.