Assistance in picking a distance sensor to work with an arduino uno

I'm a newbie and I would like to say thanks in advance

I'm trying to select a sensor that will that will measure a distance between 1 - 12 inches, i have a looked at few examples from balluff that meet this distance range, however the balluff sensors have an operating voltage between 10-30 volts which exceeds 5V capacity of the arudino. I was thinking about using an external power source to supply the 10- 30 volt range and then connecting the other inputs from the m12 connector into the arduino. Would this work ?

That is the first sensor I'm interested in and below BOS 18M-PA-LD10-S4

The other sensor

You might consider 5V sensors like these:

None of the choices above would work