In Islam halal and haram is explained well. However, there are many issues which fall between two thus becomes doubtful. The question contains two different cases; one, hair dressing and second, man’s hair dressing to a woman or vice versa.
The ruling for the first case obvious which is halal. In the Prophet Muhammad (pbuh) time he had barbers who cut his hair. He is the best role model for all Muslims, thus Muslims should follow him in their life for every matter.
Unfortunately, modernity brought many new issues which Muslims have been facing and struggling to find Islamic answers for them. One of these issues is related to the case mentioned in this question. Today, hairdressing is a profession and the performer and receiver of it can be from both genders. While performing this professing male or female hairdresser touches the hair of opposite gender. This act needs to be examined well in order to find the right answer for this question. If the touching the hair arouses sexual feelings in the heart of the hair dresser or the client both sides should take great considerations to avoid the bad result. Sadd al-Dharai (Blocking the means which lead to evil results) is a principle in Islamic law which is established to protect people from committing unlawful acts. If means leads to unlawful acts it is also unlawful to avoid sins from the beginning. For example, looking at naked male or female is prohibited because it can lead to fornication and adultery. However, it is not possible to say that performing the hair dressing to opposite gender can lead to adultery or fornication, but there is a chance it might be the case. Moreover, the probability for committing a sin while performing the hair dressing and after it is not the same for every person. Generally, people perform their profession and do not feel anything other than performing it in the best way possible. Because, it is their job and they act professionally. However, there is a chance that some individuals can feel sexual feelings while performing or receiving hair dressing, thus they should be careful in this matter. But, their personal case cannot be generalized and the fatwa cannot be given accordingly. As a conclusion, it is not easy to give fatwa for this question. Nevertheless, I can say that if there is no serious probability to commit a sin when performing hair dressing or receiving it it is permissible in spite it contains non halal (unlawful) elements in its nature. The final fatwa in this matter and what is similar belongs to heart for it tells the truth all the time. Thus, if the heart feels comfort and ease when performing an act it is lawful.