Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
The fact that the Prophet (Sallallahu Alaihi wa Sallam) grew his hair long was mainly in accordance with people's customs in those days. The customs and traditions of people do not need any evidence as long as they do not go against Shariah. Al-Bukhari and Muslim reported from Anas Ibn Malik that "the Prophet's hair used to reach his shoulders." Al-Showkany said in Nayl Al-Awtaar: "This Hadith is evidence that it is likable to let one's hair reach one's shoulders or reach between the ears and the shoulders."
So, growing one's hair and letting it be similar to the hair of the Prophet (Sallallahu Alaihi wa Sallam) is better than shaving it or shortening it unless doing so causes harm to the person. In that case the priority is given to removing the harm.
Allah knows best.