Y is a consonant in yes and yellow — but almost everywhere else in English, it's secretly a vowel, and it makes three different sounds depending on where it sits in the word. Here's the full pattern.

Y as a consonant: only at the start of a word
When Y opens a word, it's a consonant with its own distinct sound: yes, yellow, yarn, yawn, yolk, young. This is the only position where Y behaves like a regular consonant.
Y as a vowel: the 3-way split
Everywhere else, Y is a vowel — and which sound it makes depends entirely on the word's length and where Y sits in it.
The word-length rule is the whole trick
Once a child can count syllables, the end-of-word sound becomes fully predictable: one syllable → long I (cry, sky); two or more syllables → long E (happy, party). Practise counting syllables on the fingers before reading the word if the sound isn't automatic yet.
When to teach this
Y as a vowel fits naturally alongside magic-e words and the long vowels vs short vowels content — it's a similar "context decides the sound" pattern, and works best once those foundations are secure rather than taught in isolation first.