WARNING: Mozilla has a habit of changing the order and content of Firefox settings on different platforms and between versions (they seem to especially enjoy stripping options out of their mobile versions). Those changes may not be reflected here (I already have a day job).
The following procedure was tested with Firefox 136 (64-bit) on Ubuntu 22.04 LTS running the default Gnome desktop.
For Ubuntu Desktop I use the binary installer (https://www.mozilla.org/en-US/firefox/new/).
After installation, I usually make the following changes in the browser's Settings: