For me, it depends: having to hear music from other people drives me crazy, but as long as it's my own music (over headphones of course), it really helps me concentrate.
For people who can't listen to music: how about noise generators (e.g. https://mynoise.net/) to drown out ambient noise?