Upgrading .NET versions on macOS can be a hassle, last time I wanted to update I had to find and remove all installed versions with dotnet-core-uninstall.
brew tap isen-ng/dotnet-sdk-versions
brew install --cask dotnet-sdk6-0-400
If your .NET and Visual Studio Code is not working correctly, try enabling OmniSharp by going to the Extension settings and setting
dotnet.server.useOmnisharp to true.