It's a safe option for situations where you don't know what level of formality is appropriate. It's also much safer to use formal language, than to use informal language inappropriately.
But - if you are talking to someone in a formal way, and they start being more informal, and you don't - they may interpret that as being unfriendly. And talking formally in a group of friends of a similar age, in an informal situation would sound quite odd. It's up to you as to whether you are happy with that outcome...