Signed up on this forum just for this issue. I posted about this issue on rtings & avsforums discussions on the Samsung Q900RB tv (my tv).
I am having the exact same issue that you described. I've tried an unlimited number of combination of settings between my Q900RB and my PS5 video settings, tried 2 different 8K cables, tried different HDMI ports.
It works pretty regularly on my OneConnect box's HDMI port 3 (eARC), at 1080p 120Hz HDR. (Tried port 2, and it works as well.)
Port 4, which as ClassyGPU mentioned, is supposed to be the designated HDMI 2.1 port on these TV's, has been extremely problematic. Somehow, last night after testing for about 30 minutes, high framerate mode started working on port 4, just out of the blue -- go figure. But even then it's been shaky. (Closing the game resulted in my TV not returning back to the PS5 system menu, instead going to the Samsung 'no video source' screen; I had to "blindly" navigate to the PS5 reboot/power off option.) Dirt 5 has been working in high framerate mode on port 4, for now. But even then, it is 1080p 120Hz *non*-HDR ...
Yes, Codemasters and/or Samsung, PLEASE FIX.