There are times when u acts as expected (i.e., exactly like a vowel) and times when it acts like a consonants. For example:
a unicorn
an unintended benefit
It happens with consonants too:
a house
an hour
The letter u most often acts like vowel. It only acts like a consonant at the start of some words. That's not enough to drag it into the consonant category.