I also had a bad time with brew back then. On new machines these days no issues at all.
brew update && brew upgrade && brew autoremove && brew cleanup && brew doctor
Running this every few days and fixing everything that it explicitly complains about kept me issue-free for the last 10 years or so.Lately I'm running this like once every 2-3 weeks and it's still surprisingly nice to use. The problems only really manifest when you never run this "maintenance" snippet and only use the `brew install`, which will attempt to do the housekeeping stuff when you want/expect it the least.