This is because it stops them from being able to run away, according to Stanley Coren from University of British Columbia in Canada who conducted the study.
Coren analysed images of dogs being hugged by adults and children he found on the internet, looking for signs of stress, 'The Telegraph' reported.
When a dog is especially anxious it bares its teeth or may bite, but there are also 'subtler indicators' that it may be uncomfortable, Coren said.
Yawning or raising one paw is another warning sign, said Coren.
Also Read
He found that the dogs had at least one sign of discomfort, stress, or anxiety in 81.6 per cent of the photographs.
Only 7.6 per cent of the photographs showed comfortable dogs while the remaining 10.8 per cent were either neutral or ambiguous.
"Dogs are technically cursorial animals, which is a term that indicates that they are designed for swift running," said Coren.
"Behaviourists believe that depriving a dog of that course of action by immobilising him with a hug can increase his stress level and, if the dog's anxiety becomes significantly intense, he may bite," he added.
According to him, it is better for owners to express their fondness for the dog with a pat, a kind word, and maybe a treat.
The findings were published in the journal Psychology Today.