UE4 is not a "new" engine. It was released in 2014 and PS4 in end of 2013.
They are the same age ... so it's not that a "new" engine overstrains the poor old console.
I am not even sure that the switch to UE4 will result in better graphics in F1 24. You see that in WRC: that graphics are not really better than in the old games (to my perception they are even worse). So may be F1 24 is a compromise for the future. Switching engine (and possibly sacrifying graphical improvements for now) allows/forces to rewrite a lot of code form ground up (not only graphics wise - an engine does much, much more), and may be is strategic to be able to do the step to UE5 in F1 25/26 ?
Time will tell.