Set up Google Photos to back everything up to the cloud. Do it at full res for now if you need to keep the originals.
Set the camera up to save photos to internal storage. See if you can reproduce. If so, get a replacement and let someone else figure out what's wrong.
If you can't reproduce, format the SD card and try moving pics back to the SD card. See if you can reproduce. If so, try another SD card and repeat. If that's still doing it, get a replacement and let someone else worry about it.
SD cards have a limited amount of times they can be read from and written to. After a while, they just go tits up. This will happen to every SD card eventually. They're also cheap products that get turned out in huge numbers. When that happens, bad ones can slip through the cracks. Bad ones tend to not last very long at all. It could be that your SD card just lost some data somewhere or data is written to a bad spot on the card. Or it could be something in your phones software that is not reading the images after the media is scanned. Stranger things have happened. That would be a wild-*** random glitch that you will likely never see in any other phone ever again.
My gut says your SD card just needs to be formatted. That fixes most problems. But if you find that it is the SD card itself, just buy a new one. SD cards are replaceable — memories are not.