A lot of this stuff isn't becoming "unsafe" per-say but "inert". Chemically processed components have a shelf life that deteriorate over time. So a liquid soap can congeal or lose its potency or develop a weird smell over time. Gasoline evaporates, leaving behind a gum that can clog engine parts. OTC pharmaceuticals like aspirin lose potency of their active ingredients and become what amounts to a salt pill.
A lot of these dates are simply there for the sake of liability. If you use a ten-year-old hand cream and it gives you eczema as a result, the manufacturer isn't liable. But this stuff doesn't magically become lethal the day after the "use by" date.