The spacebar on my MBA 2022 M2 is suddenly not working adequately. I hit it with my thumb as usual, and it doesn't leave a space often, sometimes multiple words, even when I'm trying to press it harder than usual.
Sounds like it may have some dirt or crumbs under it perhaps. You could try a can of compressed air (read the directions, don't shake it, typically) and see if you can blow it out. Or take it to Apple and have them look.
As suggested above try clean it with compressed air or take the key cap off. It might just need a blast of air or might be the tiny fragile clips have broken. I had this issue once where after a week of usage one of my keys got stuck and it was the plastic clip that had broken off and was stopping it pressing down.
Or take it to Apple. I assume you're out of warranty so good luck. They wouldn't fix mine even though I was still under the 14 days return period. I returned it and bought a new one.