Today Xcode gave me the error "Package.resolved file is corrupted or malformed; fix or delete the file to continue: malformed" when opening and running an xcworkspace with a Swift package and a sample app.
That is exactly after a successful pull request, so the project has built successfully before. The problem was fixed by manually removing the file, doing a "clean build folder", then quit Xcode and the simulator. Then started Xcode again and opened the workspace: it built. Just a tip for when you encounter this behavior.
In our case, Xcode actually downgraded some dependant package in (minor) version. So this may not actually be the final solution for you.
Note that this is NOT the same as the error that Xcode 13.2.1 or lower shows when someone else opened it with 13.3 or higher. From that 13.3 version and upwards, Xcode will upgrade the Package.resolved file to a new v2 format. But we never opened the project in any Xcode version higher than 13.2.1. That error reads: "Package.resolved file is corrupted or malformed; fix or delete the file to continue: unsupported schema version 2".
I'm not yet happy with the way Xcode handles Swift Packages, it feels unreliable in the current version. But it'll probably improve in the coming versions.