Someone posted about this issue here: https://news.ycombinator.com/item?id=15037960

I've got a Galaxy S3, an S4 couple first generation Moto Gs, a 2012 and a 2013 Nexus 7, a Note 2, I think? 2 Note 3s, and a One Plus One in various states of: loaned to cousins, used as house phones, backups in a drawer, backups in cars, or lying on my desk.

They were all either broken, at yard sales, given to me my clients / contacts that don't want them, or were <$20 on ebay.

In general four things kill these devices:

Touchscreen breakage. It is almost never worth trying to replace if the screen cracks.

Flash burnout. Shitty flash chips don't last forever. I've binned almost every older phone than this crop because the flash memory dies.

Charger port wear. Microusb sucks, replacement parts vary wildly depending on model - I can get an S series charger for <$5 most of the time, but trying to replace a Droid phone charger once was impossible because the charger harness was soldered to the pcb.

Software. I generally outright ignore devices without a ROM scene and an unlocked bootloader, but even then it is entirely volunteer how long Cyanogen/Lineage/Paranoid/etc are willing to keep supporting these fossil kernels. The S3, Note 2-3, and original Nexus 7 are all on their deathbeds because of lagging community support for these devices. It is worth mentioning, however, for the Samsung devices they have gone community supported far longer at this point than their official support periods lasted. Great job Samsung.

Batteries are usually a non-issue. You can buy shitty Chinese knockoff batteries (or if you are lucky Anker) that don't hold a charge and don't last long, but you can keep these devices running on bootleg parts for a while.

The software is the ultimate killer. What should be the easiest to maintain is the hardest, because corporate greed and hunger for control trumps customer respect. All my mobile devices are cheap, used, or broken when I get them because none of these exploitative abusers are worth giving a direct cent to.

Sadly mobile flash doesn't support smart monitoring. There are three indicators, but your flash can randomly fail without any of them being observable:

Sector reallocations. As flash stops writing or reading the package will reallocate data. This process is intensive and usually lags out the phone. If when moving large amounts of data into / off the flash the whole phone is freezing, it can be due to this.

Stunted read / write speeds. As the flash degrades and more sectors go bad, your read and write performance suffer. Fragmentation gets worse as working sectors dry up. If your phone was benching ~80MB/s read or write speeds the day you got it and is down to ~20 5 years later, it is likely nearing a failure point. This is usually a gradual aging thing, but you do often see a steep slope of sudden performance crash before the whole chip becomes unusable.

Crippled access times. The former was data rate, this is data latency. The latency should always be consistent and not age much throughout the life of the chip - the ability to access flash almost always stays near-constant over the lifetime of the chip. If this starts going, for very small data sizes, the chips controller can be dying. Which happens, because in phones a lot of corners are cut, and flash mmus are often really, really cheap.

There is also the really rare chance you find a corrupted file you cannot open that used to work, which can in extremely rare circumstances mean that your phone has ran out of unallocated sectors and is now losing capacity including written data, but that is highly unlikely - flash almost always becomes unwritable way before becoming unreadable, and your phone will fail before unreadability starts manifesting en masse.

It would be useful if we could get A. lifetime write averages for the flash chips in popular phones and B. trace such a number throughout the lifetime of the device, but we don't have those, so you are almost always flying in the dark on when your phones memory will die.