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.
So, if the scenario is applicable, removing write protection on the SD card will resolve the issue. If you are using a card reader, remove the card and then check there is a Lock written on the side.
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.