Class not found except after composer dump-autoload -o

So I was told to run composer dump-autoload -o after a "class not found error." But it only works if I continue to run composer dump-autoload -o all the time when I make changes.

What’s causing this error, and is there a way to bypass this