It’s available on Homebrew/brew’s latest GitHub release. pkg installer also installs Homebrew to its default prefix ( /opt/homebrew for Apple Silicon and /usr/local for macOS Intel) for the same reasons as above. You have to confirm everything it will do before it starts. It tells you exactly what it will do before it does it too. It is a careful script it can be run even if you have stuff installed in the preferred prefix already.
This prefix is required for most bottles (binary packages) to be used. The script installs Homebrew to its default, supported, best prefix ( /opt/homebrew for Apple Silicon, /usr/local for macOS Intel and /home/linuxbrew/.linuxbrew for Linux) so that you don’t need sudo after Homebrew’s initial installation when you brew install. Instructions for a supported install of Homebrew are on the homepage.