Is your Media Library populated with images that are not displayed? When you click them it says image does not exist any more and gives you 404 page?
This is broken link issue. There is no file for that attachment stored on web server any more so you are seeing this empty squares in Media Library as ghosts of previously existed images.
This function will clean up your WordPress Media Library from non-existent images. It will delete all attachments which files no longer present on web server.
*Mind that if you have a link to such file somewhere in posts it will stay there and still give 404 to users. To explore this issue and find such broken links in posts I use Screaming Frog.
Caution: resource greedy.
You are always doing backup before something like that. Right?