Change MyGame.uproject to use the source build, right-click and change version

Open the uproject in rider If you're using Visual Studio, open UE5.sln, not MyProject.sln

Build it will only build what you use

What to distribute to team-mates

native vs foreign https://docs.unrealengine.com/5.1/en-US/managing-game-code-in-unreal-engine/