Some packaged foods have a "sell by" date instead of expiration, so I don't pay as much attention to that. I use my best judgement and the "sniff test" for a lot of things, but typically if canned goods are expired I get rid of them. (Because in my last pantry cleanout I had some stuff that had probably been there since 1999.)
Canned goods are perfectly safe for decades provided the metal is not damaged or corroded. Louis Pasteur demonstrated that it is microbes that cause putrifaction and if the product has been properly prepared to kill them off by heating then unless later exposed to air it will still be safe to eat. However, regardless of the use by date, any can that is damaged, dented or bloated should be rejected. Botulism is deadly.
Jars and bottles should also be safe provided the seal is intact. The worst that can happen is that the contents, if exposed to light, could discolour. However, once opened the contents will go off quickly. The exceptions are pickles, jams, chutneys and fruit in syrup because salt, sugar and vinegar are natural preservatives. They can last for a long time even after opening.
The sniff test is the best way to ascertain whether fresh food is edible. A container of milk, once opened should be consumed quickly. In hot weather milk can start to sour before the use by date. I doubt that sour milk is very dangerous, after all we enjoy sour cream, but the texture and taste are unpleasant.
I freeze all meat, chicken and fish and then the use by date is obsolete. Once thawed is it unwise to refreeze because it would not now be 100% free of bacteria. During thawing they start to multiply and if the meat etc is refrozen and thawed again they have a head start and may reach dangerous levels. Solution, cook ASAP after thawing to kill any bacteria before they produce any toxins.
The ancestors managed to survive without refrigeration or use by dates by using their common sense. We should use date stamps as a guide only and rely on common sense for food safety.