Many, many words can be used in both an uncountable way and a countable way. This is especially true of uncountable food and drink, such as 'coffee' or 'yogurt'. When we're talking in general about coffee or yogurt, the words are uncountable. But, we can use them in a countable way when we mean 'one cup of' or 'one pot of':
Uncountable: Coffee is my favourite drink.
Countable: Could you buy two coffees and two teas, please?
Uncountable: My children eat a lot of yogurt.
Countable: I bought a pack of six yogurts.
Other words that act like this include: water, juice, salad, curry and cake.