Most shelf-stable foods are safe indefinitely. In fact, canned goods will last for years, as long as the can itself is in good condition (no rust, dents, or swelling). Packaged foods (cereal, pasta, cookies) will be safe past the ‘best by’ date, although they may eventually become stale or develop an off flavor. You’ll know when you open the package if the food has lost quality. Many dates on foods refer to quality, not safety. See FSIS’ Shelf-Stable Food Safety fact sheet for more information.
This thing about “if it is past it sell date throw it out” probably applies to open stuff or easily spoiled stuff like milk, but otherwise the sell by date is more a product of lawyers and not science. Often times it is a reflection of how far they have data for as opposed to when they know it will be bad. For example, Mountain House was only allowed to advertise that there food was good for 20 years after they had stored the food for 20 years and then tested it in a lab to see if nutrition data still met the claims on the packaging. Other sellers of similar products don’t say there food is good for 20 years and I am going to guess that is because of lack of data and not because there is some magical difference between different types of freeze dried foods.
In any case, you would not eat food that tasted/smelled bad just because the packaging said it was still good and you should not throw out food that tastes/smells good just because the date says it is bad.