If your Unreal Engine 5 Editor crashes upon selecting a project or if your UE4 editor also behaves like this, then this solution might just work for you.
Basically, if you have MSI Afterburner and Rivatuner Statistic Server installed, Rivatuner will detect Unreal Engine 5 and start the overlay on it, but it will not detect UE4 by default. When it creates an overlay on Unreal Editors, the editor gets a D3D error and crashes. I hope the Unreal Developers can fix this issue.
You can fix this yourself by either closing MSI Afterburner and Rivatuner Statistics Server by opening them in the system tray and then clicking on the exit button, or you can make Rivatuner stop displaying the overlay. To do this, open Rivatuner and then click on the green “Add” button on the bottom left. Next, navigate to the Unreal folder and then to Engine\Binaries\Win64 and select the UnrealEditor.exe or UE4 editor.exe. Once that is added, click on it in the menu on the middle left in the Rivatuner main interface. Next, set the “Application Detection Level” to “None” and you are good to go!