Little residential hvac help please. Newer unit leaks water once a year.

That doesn't look like a P trap.
Looks more like elbows and I don't see a vent.
Pick up a pre made trap and see the difference.
(Hvac supply house should sell clear ones with a vent and built in brush to clean).
Check the slope of the line leaving the tray and then cut out the elbows and glue in the new P trap, maintaining the proper slope of at least 1/8" per foot.

Screenshot_20230827_163230_Chrome.jpg