What i can say is for ue5 at least, ps4 controller are not detected by default. You need to enable it plugin and the playstation sdk(need an official ps account for that).
Or use of DS4Windows that will make the ps4 controller compatible to unreal engine without issue.
So it should be of similar behaviour for ps5 controller on ue4.
*only on editor, i havent tested on shipped version.