Ordinary HRTC buses to McLeodganj are safe for the most parts but won't be comfortable after they cross Una and the hilly terrain starts.
i would recommend going for a pvt bus and travelling during the day as then your sleep won't be hampered and you will enjoy the stay.