I just bought a (used) M1 macbook air and noticed the same problem. (I'm running macOS 15.5).
However, in my case, I noticed it is NOT a hardware issue, it is definitely a software issue. It has nothing to do with the lid sensor.
Yes, I've heard people say if they close the lid, and re-open it (a 2nd time), the screen will turn on as it should. (This applies to me as well).
BUT I've found an easier work around: If you try to wake your computer from sleep, and the screen stays dark (i.e., the screen pixels turn on but not the blacklight), hit ESC (to turn off the screen again), wait at least 1 second, then press any other key to re-wake it a 2nd time, and the screen will turn on properly.
It's not a fix, but it's much easier than repeatedly opening/closing your screen (and puts less wear and tear on your hinges too)