The Ubuntu "Sound" configuration panel in the system settings (click the top right corner, then click the spanner and screwdriver icon, then select "Sound") can leave a bit to be desired in how much information and control you can get.
For full control of the various audio capabilities of your system, I recommend to search and installed from the Ubuntu Software Center the "Pulse Audio Volume Control".
After you install and run it, you can go to the "Output Devices" tab and see all your audio devices and what port is enabled.
For example - on my laptop, I can see the "Built-in Audio Analog Stereo" as the first device, and the "Port" menu shows which output ports are available. As you can see in the screenshot below, I can use either "Speakers", or "Headphones", though the latter are unplugged:
When plugging headphones into the headphones port, the port should automatically change to specify "Headphones (plugged in)" :
At any point you can control individually the volume for your speaker, or headphone.
That being said, the fact that the headphones are detected and select in the "Port" menu doesn't mean applications will necessarily will play to them - if you have more than one devices (as can be seen in my configuration).
First, it is suggested that you click the blue button on the right side of your output device where the headphones are plugged, to set this device as the default output for new applications - on my setup you can see that the last device is actually chosen as the default output (it is my dock).
After which you can see which applications are running and what output device they are using, using the "Playback" tab:
You can see that I have "mpv" playing to the "Built-in Audio Analog Stereo" - which is the device where the headphones are plugged into. If this is not the correct device, you can click the button showing the device name, and choose the correct device.