The consonants /y/ and /w/ are phonetically like vowels but phonologically like consonants. They are approximant consonants and can be found at the beginning of words like "yet" and "wet" for example.
Looking at these two consonants from the phonetic point of view, the articulation of /y/ is very similar to that of a front close vowel (such as /i:/) and /w/ is very similar to /u:/. Despite the vowel like character, we use these two sounds like consonants.
They only occur before vowel phonemes which is typical for a consonant distribution.
A word beginning with /w/ or /y/ is regarded as beginning with a consonant because the indefinite article before a consonant is "a" and before a vowel is "an" (examples: a car, a dog, an airplane, an image etc). A word beginning with /w/ or /y/ is always preceded by the indefinite article "a" (examples: a way, a year etc).
Another example can be the definite article "the". The definite article "the" is pronounced /ðə/ (example: the cat /ðə kæt/) before a consonant and /ði/ before a vowel (example: the airplane /ði ˈɛərˌpleɪn/. This, once again, demonstrates why /w/ and /y/ are phonologically consonants.
Pronouncing /w/ and /y/ as fricatives or affricates is a mispronunciation. However, in special contexts we can hear the friction noise in /y/ or /w/. Good examples will be the words "twin" /twɪn/ and "pure" /pyʊər/. This happens when the consonants /w/ or /y/ are preceded by p, t or k at the beginning of a syllable. In these contexts they become voiceless and slightly fricatives. For place of articulation, /y/ is considered palatal and /w/ bilabial.