I've had a few occasions where someone cleared out cabinets in their kitchen, and gave contents away. General findings:
Dry stuff (pasta, cookies, rice, beans, spices, etc): fine for years (if not a decade+) past its best-before date.
Canned food: if hermetic seal is intact, it's edible. Personal record: ~25y old fruit cocktail. Physical structure was poor and taste was bland, but it was edible.
For fresh foods like meat, dairy, vegetables etc: look, feel & sniff. It's almost always obvious when it's gone bad.