Multiple .NET SDK versions and PowerShell on macOS with Homebrew

How to run multiple .NET SDK versions on macOS with Homebrew while keeping PowerShell working, by using alternate casks and adjusting PATH precedence.