I would say, the easiest way to connect a NPN one would be a relay. You could also use a voltage divider direct at the GPIO PIN. But that is dagerous for the Raspi and also you have to use inverse logik. So I show you the Relay version only.
simulate this circuit – Schematic created using CircuitLab
The V+ and GND wires of the sensor are connected to the power supply. One side of the relay coil is is connected to the V+ of the power supply. The other side of the coil is connected to the Sensers OUT wire.
If the sensor switches on, the OUT wire of the sensor draws current through the coil and the relay switches on. Then the 3.3 V pin of the raspberry gets connected to the GPIO pin.
The R1 resistor pulls the GPIO pin down to GND as long as the relay is off. So, the GPIO pin avoids floating around. That's all. Be sure to use a relay that closes when its coil gets powered.
Attention !!! Use the 3.3 Volt of the Raspi not the 5 Volt pin. The 5 Volt pin could damage the Raspi.
I don't know your neither your power supply nor your sensor type. So all values are guessed.
There is a risky way of connecting the OUT wire direct to the Raspi.
This includes that you set the internal pull up resistor of the used GPIO pin active and connect the GNDs of the Pi, the sensor and the power supply all together.
Your sensor uses voltages of 10-36 Volts. I.e. you have to power it with the 12 Volt output of your power supply. You should avoid connecting the 12 V to the Pi. Be sure not to do so, it would kill it.
Here is a PPK-CAD export ;-) :
I think it is possible to use the internal pull up resistor. If that would not work, you could add a - lets say 4.7 kOhm resistor (R1) alternativly.
The elgo relays have 5V input AFAIK. They do not work with the 12 Volt of the power supply. But, instead of connecting the relay coil to the 12V power supply, you could connect it to the 5V of the power supply.