I recently had this issue, it turns out my SD Card was not compatible with my phone. I got it replaced with a 10 Class SD Card and the problem was fixed.
Both the SIM and SD cards at the same time? Sounds like a hardware failure on the board in the area of the card ports. Has the phone gotten wet or been in a high-humidity environment recently?