It's called "Wave-particle duality". https://en.wikipedia.org/wiki/Wave%E2%80%93particle_duality Basically a light wave can behave like a bunch of particles flying in one direction or like a wave. And it has been tested in the famous "double slit" experiment, where the interference image was disappearing on the other side of the barrier with two slits when the light wave was observed up close.
That switching back and forth is caused by something known as "Quantum observer effect". https://en.wikipedia.org/wiki/Observer_(quantum_physics)
All this feels like an optimization, it would be rather expensive for the Universe to calculate locations of all particles at all times, so it just simplifies it with a wave function. Sort of what we do in video games.