In the last few years almost every time a memory card has failed on me it’s for the same reason - the lock switch gets stuck to locked rendering the card useless, destined for the bin.
An SD card is just like a small hard drive — it's a device that can store and transport large amounts of data. If you've been using an SD card for a long time, you might need to clear it out.