It's dependent on the Desktop Environment.
OBS just uses xdg-desktop-portal. I think OBS allows you to to configure which encoder to use. So, for the most part, there really shouldn't be interesting differences in performance.
But like I said, KDE is fine, but Gnome's implementation for xdg-desktop-portals has issues. This is a work item on mutter demonstrating OBS failing to record at 60 FPS. There have been issues all the way back to 2020 on Gnome's screen recorder not performing well.
My best guess for why this happened is that Gnome's recorder was originally written for remote desktop with low bandwidth and high latency environments as a focus. I think the goal was to only send frames when changes were detected to them. But when the FPS becomes too high, Gnome fails to provide frames fast enough because it's stuck doing damage detection or whatever.
So in this case, it would be better for Gnome (for now), as it would allow at render rate FPS recordings.