This sensor is essentially a reed switch, encased in a plastic shell. Normally the reed switch is 'open' (no connection between the two wires). The other half is a magnet. When the magnet is less than 13mm (0.5") away, the reed switch closes. They're often used to detect when a door is open, which is why they have mounting tabs and screws.
Normally open reed switch & magnet.
ABS enclosure for reed switch & magnet
Rated current: 100 mA max
Rated voltage: 200 VDC max
Distance: 15mm max