This.
Unless you do not want to use the front port(or back port) because of static interference, consider a sound card with multiple 3.5mm/rca for your speaker and headphones.
An external USB Dac such as the Xonar U7 will fit your needs, but priced at $130+, you can plug both headphone and speaker in it, and when you press down the volume button, it will switch between speaker and headphones instantly.