For UE5 you can safely delete everything BUT:
Config
Content
Plugins
Source
*.uproject
*.sln
*.xcworkspace
I like to keep the *.sln (VSCode) and *.xcworkspace (Xcode) because there is no need to recreate them (they’re tiny).
Doing a rebuild recovered about 30 gigs of disk space for a project. Needless to say I was a little surprised.