The LJ12A3-4-Z/BX proximity sensor will detect large metal fields at 4mm distance with great precision. This allows you to accurately measure the distance to an (aluminum) heated bed for example. If you are using a glass plate as your print surface, you can use aluminum foil right below the glass, which will also be detected by the sensor (mirrors however are not detected). The sensor is equipped with a small red detection LED, indicating a nearby object. The sensor has an M12 threading and includes a nut for easy mounting to your 3D printer or CNC machine.
The LJ12A3 is a NPN Normally Open (NO) type of proximity sensor, which means when nothing is detected the resistance on the black wire is high. Upon detection the resistance will be low and connects to ground. Use the internal pull-up on your Arduino.
Most modern 3D printer firmwares have some sort of auto bed leveling procedure available, but you will need to enable it. You can use this sensor as the z_min_endstop for example, replacing your current end stop. Most firmware will also use the min endstop as a probe, but some allow a separate probe to be defined.
This sensor operates at 6-36V, so as the signal voltage is the same as the input voltage, also the signal will be 6-36V. You will need to down-convert the voltage to acceptable level for your electronics. Put a 10K resistor between the black signal line and your 5V electronics input to avoid damage.