This sensor is essentially a reed switch, encased in an ABS plastic shell. Normally the reed is 'open' (no connection between the two wires). The other half is a magnet. They're often used to detect when a door or drawer is open, which is why they have mounting tabs and screws.
The PTC thermistor mz6 series sensors are temperature sensitive, and positive temperature coefficient thermistors (PTCs) have higher resistance values at higher temperatures. They belong to semiconductor devices and can be used in series with a single or multiple motor protectors.