UPDATE 2020-01-19: This is now a really mainstream thing, with tons of small amps on the market having a line-in socket alongside the instrument socket so you can plug in a phone and get it as a backing track. My Roland Cube mini has it, but plenty of other brands do it too. Some of them even do Bluetooth.
Original answer:
There are quite a lot of products available which take guitar signal and an aux signal, and combine them into a headphone. Here's some photos of some - one cheap, the other more upmarket.
I googled "pocket practice amp aux".
With these one, you would plug the large input jack into your guitar. You would connect an MP3 player (or whatever) into the 3.5mm aux-in, and headphones into the headphone socket.
This one does its own overdrive effect.
You could also use other pedals and plug this device into the output of the last pedal in the chain; and you could connect the headphone signal to the aux-in of any amplifier, to practice without headphones.
There are also similar devices designed to be used with computers, phones and tablets, in which effects are emulated by the computer. This is more expensive, but more flexible, and adds opportunities such as recording.
If "pocket" isn't a feature you want, you could look at using a PA amp with multiple inputs. I have an Alesis portable PA amp with mic, instrument and phono inputs each on a separate gain control. It also has a headphone socket for private practice. If you use something like this, you probably need an amp simulation pedal to make the guitar sound musical. Zoom's multi-FX pedals are a cost-effective option.