As said above, refer to datasheets, most of which are pretty conservative regarding Flash data retention. Although Flash memory has certainly a limited retention, I've personally never witnessed data loss in devices up to 25 years old.
20 years minimum is common from manufacturers' specs. That's never going to be failures "within a few years", unless you constantly WRITE to it. So that being said, if you're using part of the internal Flash of some MCU as NV memory that you often write to (to replace EEPROM for instance), then of course you'll shorten the MTBF.
Now if you want long-term retention (several decades), do not constantly write to Flash... and use mask ROM if you want really long-term.
For devices using Flash memory as code memory that is read only for most of its lifetime, the probability of something else failing first is pretty high IME (such as power supplies, dried capacitors, solder cracks, overheating, etc.)