Forgive me if I get this wrong, but I think if the words are used to modify another word, then you hyphenate: “he is a friend from high school” / “he is a high-school student” - I think the rule has a clarity exception - if the hyphen makes it less clear, leave it out. High school is a very common term for most folks. However, you could play devil’s advocate and point out that a person reading “he is a high school student” could interpret that unhyphenated modifer as “he is a stoned school student”.
My favorite reference of all time is the Associated Press Stylebook. It’s spendy but def pick one up if you can afford it - they do such a good job of explaining EVERYTHING with examples, and the book itself changes and updates each year. If you spring for one - get one with a wire binding that will lie flat.