Steam Deck natively recognizes the PS3 controller. Simply plug it in via USB, wait for Steam OS to recognize it, then unplug USB cable and it will work over Bluetooth without needing
The Playstation 5 DualSense controller only works in the main menu, not in games.
How To Fix PS3 Controller When Pairing Fails with Playstation 3 After Resetting Controller - YouTube
Things You Should Stop Doing On Your PS5 Immediately