On Ubuntu this is very easy since it comes with a snap of Firefox already.
So for Ubuntu changing to the ESR version is just opening a terminal and running some snap commands.
Open a terminal and list your snaps:
Now lets get info on firefox:
snap info firefox
Now lets install the ESR channel:
sudo snap refresh firefox --channel=esr/stable
When it completes the ESR version of FF will be installed (check with the help-about section in FF):
It is very easy to use snap as you can see. For Debian we have to do a bit more as snap is not installed by default.
So in Debian lets open a terminal and type: (Note: If you have a firefox profile you have been using you will need to back that up or you will lose all your tabs/saved passwords etc if you dont make a copy.)
sudo apt-get purge firefox-esr
You will note that if you read the output Debian must have a web browser installed as part of its apt requirements so it will suggest chromium instead of Firefox. We will accept this recommendation and just press y. We want a sandboxed version of Firefox for daily use and will keep chromium as a backup browser in case we need it.
Now we need to install snaps:
sudo apt-get autoremove sudo apt-get install snapd sudo apt-get install gnome-software-plugin-snap sudo systemctl list-unit-files | grep snap sudo systemctl start snapd.service sudo snap search firefox sudo snap info firefox sudo snap install firefox --channel=esr/stable sudo reboot
(Reboot is done or snap doesn't seem to initialize properly and add firefox to your list of apps in the activities menu. I did take a quick look for a service that needed started but wasn't able to see one really quickly so just moved on. Everything works as expected after the reboot anyway but feel free to poke around a bit more if you want to try avoid rebooting. Most likely something isn't initialized right after install of snapd.)
Firefox is now working as the ESR snap on Debian also :)