Use Toolbox or Distrobox as a simplified Podman (FOSS Docker without the daemon bs).
You either install both Firefox and dependencies in the Distrobox container, or you install just the dependency you need and symlink, export, or alias it, (depending on how you want to access it by system, user session, or bash respectively).
Be aware that by default these container distros in Toolbox/Distrobox are bare bones terminal like sandboxes. They do not have all of the GUI graphics stuff installed, so you may need to install a few extra bits for x11 or Wayland support and such.
With both Distro/Toolbox, it defaults to a copy of your distro for the sandbox, but you can choose nearly any other distro too. Gentoo is one of the most advanced distros, and the Portage/emerge package manager enables source code compilation configurations unlike any other distro. That is always an option for really getting into the weeds. Much of Arch's binaries are actually built on Gentoo... And thus why Arch may already have exactly what you need if spun up in a distrobox container no matter what distro you are on.
I strongly recommend creating an additional user on your system first and installing the sandbox with this unique user. Use the groups attribute to give access to your main user if you need it. Sandboxing in this context is only about dependency issues and not isolation or security as the ambiguous name implies. It will still make files and stuff all over the place. If a unique user session creates the stuff it becomes possible to find everything that users owns and therefore remove it at a later date.