It's not necessarily just units, though that's one useful example. Types could also include things like whether a text string has been escaped in a certain way, whether data has come from a trusted or untrusted source, and countless other reasons you might want to ensure you don't use a value with a certain property in the wrong way.
In modern languages where defining custom types and enforcing their use is easier, there is less need to distinguish these properties by convention. Twenty years ago, when we were doing more development with languages in the C family that don't have very powerful systems, it was a different story, and so naming conventions went some way to helping keep track of what data you were really passing around beyond just "It's an int" and the like.