If we omit all the technical details, then as the singer Bjork said: "You should listen to music not with your ears, but with your chest, stomach, insides!" That is, to feel with the body, and not just receive information directly into the ears
There is a difference in terms of perception and psychology of others and your safety. When you listen to music with headphones, people have no desire to kill you, or even "teach you good manners".
Perceptually, the main difference is that when listening with headphones, there is no room reverberation and no interaction between sounds from the left and right channels. You can also notice that the small distance between the sound source and the eardrum leads to the appearance of a comb filter at high frequencies, this depends on the design of the headphones, and in closed-type headphones it appears to a greater extent.
Most sound engineers believe that you cannot mix music with headphones, you can only use monitors (specially designed speaker systems with a fairly flat frequency response). If you mix in headphones, then on speakers or monitors you can find problems with the balance of instruments and a stereo panorama, at the same time, if you mix on monitors, then everything sounds pretty decent in the headphones. There is such a thing as mono compatibility, which occurs when adding the left and right channels, when playing back signals that are in antiphase in the left and right channels, or with some kind of phase shift - on the speakers and in the headphones, this situation will be perceived differently ... Although there are also those who like to make music specially for listening in headphones, in this case there are opportunities for some of their stereo chips. I have seen experiments with sounds, in which people, using sounds of different frequencies in different ears, tried to influence the occurrence of alpha and beta rhythms in the brain, of course, this is only possible when using headphones.
In general, listening to music on the speakers it is perceived as more natural, but headphones also have their advantages, due to the lack of reverberation, you can notice some small details or isolate yourself from the surrounding space.