Why Gallery and Music app are unable to read SD card storage while a file explorer can?

I checked my phone after a while (after 3 hours), and I found that all of my photos and songs were not there anymore. I checked my ES file explorer, because by default, I have Google files (which is not a good way to manage files). I saw everything was fine in ES explorer.

I rebooted the phone a couple of times and even pulled out and reinserted my SD card but it didn’t work.

How can the problem be fixed?