For example when a dog put his paw on another dog with some pressure, the other dog will see this as a threat. If it is light, without pressure, the other dog will view it as an invitation to play. So when you pet a dog’s head with some pressure to the pat, the dog may think you are being threatening.
Also, consider that dogs do not touch each other when they first meet. If you watch two dogs meet for the very first time, you will see a lot of sniffing, tail movements and body posturing but they rarely actually touch until they completely accept each other. So when you reach out to touch a dog that is a stranger to you, that dog may not understand that process.
Some fearful and shy dogs have been socialized with other dogs and not much with people. These dogs will be thinking in canine terms as they are not familiar with human ways. To a dog, there are certain reasons for touch. They are to get attention, to bond, for mating, to show submission or dominance, to play and to get comfort. Keep that in mind as you work with your dog.