It's a mild criticism for something the person being spoken to has done, but the words also carry affection delivered as a mild reprimand.
Because of the 'affection' it carries, it is not something you would say to a stranger unless a child.
It's possible to use the words between adults, but the words - though a reprimand - carry affection, so it can only be used in certain situations. A husband/wife, partners, etc. When spoken by an adult to an adult, the words are more often said by the female, not the male.