I am not sure there is any way to have two different audio apps running at the same time, especially if you only have one audio device in the system. It may be possible if you have 2 audio cards, but don’t think it likely if you only have one audio device.
PulseAudio Volume Control (pavucontrol) can do this. For example, here I have Firefox going to my USB headphones while Rhythmbox plays music to my laptop speaker:
But, for built-in headphones vs. speaker, it gets more complicated. See in the above how that’s all one device? That device then has a configuration option for “Port”, which can be speaker or headphones:
So you can’t just change that in the GUI. You’ll need to go into the PulseAudio/Pipewire configuration, if it’s even possible. And someone with more knowledge in that area will have to answer that part for you!