The Playstation 5 DualSense controller only works in the main menu, not in games.
This is a very brief note about a problem that recently happened to me.
After normally starting my PS5 with controller by pressing the central PS button, the console would start up normally. I was then able to browse menu, store, settings etc. After starting the game I was greeted with the normal couple of splash screens, then the standard press X to play appeared. And that's when things started to get a bit worrying.
I couldn't press X or any other key (in other games with "press any key to start").
Strangely, I was able to return to the system screen (main menu) of a console using the PS button. Then again, all the buttons in the said menu started working.
This could be one of two things. Either your controller is dying, or one of the buttons on your controller is stuck, preventing you from getting the full game experience, so the controller has stopped working without telling you what is wrong.
If you want to know which buttons are not in the rest position, and you can't check them in the console menu, there's this great website https://gamepad-tester.com/ that lets you test all the buttons on your controller.
In my case (as I discovered later) the L2 bumper/trigger was somehow depressed even in the neutral position. For lack of a better idea, I simply pushed it outwards from the controller with extraordinary force. Both the trigger and the plastic housing shook a bit, but this actually helped and freed the trigger from phantom pressure.
If your controller doesn't have any potentially pressed buttons, and still you can't start a game, there's a trick to get around this: Start the console normally, then start the game you want to play, when you reach a screen that requires an action like pressing X or any other key, flip the controller over and press the reset button for as long as it takes for the controller to turn off its LEDs. This means that the controller will reset and when it comes back online you should be able to press any button and start playing.
You will need a thin needle to do this. Also remember that this is not a permanent fix. If you turn your game off and on again, or switch to a different game, you will need to reset each time.