How to update XCode with a different userid?
Delete the app from /Applications and then re-download it from your preferred Apple ID. Launchpad deletion is a bit cleaner, but does the same thing, preserving user files created by Xcode, but deleting the application itself.

Unless you stored project files in /Applications, you won't affect project files or user settings since they get stored by default in /Users