Transistor-transistor logic defines a class of digital circuits where bipolar junction transistors perform both the logic function and the amplifying function. Operating strictly on a 5-volt supply, TTL devices recognize anything below 0.8 volts as a logic low and anything above 2.0 volts as a logic high. While largely replaced by CMOS in high-density processors, TTL established the standard 5V logic levels still used in legacy hardware and industrial controls.
Check the datasheet to see if that sensor output is TTL compatible before tying it to the microcontroller.
A floating TTL input naturally drifts high, but relying on this is a bad practice that invites noise; always use a pull-up resistor.