@ Justin your module is useless for sensing whether there is an object in the path of something.
The module is apparently switchable between PNP and NPN mode, so it doesn’t matter.
The two diagrams are really either giving you a voltage dictated by the input voltage ratio’ed down via the resistor divider, or it’s pulled up to the correct voltage (shown as 3v3). I personally would prefer the pullup scenario as I’d hate to overload my micro if the input voltage went out of spec or something…
For this reason on digital or analog inputs, I include a 3.6V or 5.2V zener with a 100 ohm series resistor to limit the current and voltage depending on the max input voltage. This handles +24V quite well for my analog 4-20mA inputs and a similar setup protects the digital inputs. Of course I also have other circuits to drop the voltage to a suitable level but the zener is the last line of defense.