I'll assume you're asking about men's hair. Since a young woman with somewhat long hair isn't typically going to be judged as harshly for it as would a man.
While I suppose I do have a slight bias against seeing a young male professional with unusually long hair, it really has to do with more than mere length. I mean, I'd probably think better of a fellow with shoulder length hair, but a generally neat and clean appearance, than I would some other guy with short hair but a generally unkempt appearance. Of course, one could argue that the long-haired men are less likely to look otherwise neat and clean, simply as a statistical thing. To what extent this is a valid argument, I'd be reluctant to speculate.
Show me a picture of the long-haired person, and I'll tell you if he looks unprofessional or childish to me. Okay?
Is a 25 year old man within his rights to show up for a job interview at a conservative law firm, sporting a "foppish" hair style? Sure, he's within his rights. But he's also being foolish - because it's unlikely that the people interviewing him will give him extra points for foppishness. More likely, they'll think "We don't need an image like this representing us to the public." Or, "If he's stupid enough to show up here looking like that, he's too stupid to be worth hiring."
And it's not just about law firm interviews; that's simply a dramatic example. Most people judge others - to a degree - on appearance. You may not think that's fair, but fair or not, it's reality. The retail salesperson, the police officer, the bank loan officer, the high school principal, your grandmother's next door neighbor, etc., will all make some snap judgments of you based on how you look. And while long hair on a man is more accepted today than it was 50 years ago, it's still going to be at least a slight negative for many people - and not just older people.
Some things about one's appearance aren't readily changed. But hair style is readily changed. Life can be tough enough without handicapping oneself; if a change to a more conservative hair style can make things easier, a sensible man seriously considers changing his hair style.
--
Michael