The most likely reason your dog is yelping when you touch him is because he is in pain and discomfort. If you find he is yelping just at you barely touching him this could be because he is expecting the pain and really doesn’t want you to touch him. Much like if you’ve hurt yourself and you tell someone not to touch your injury.
A wonderful and intelligent Collie enjoying its owners company
It is important you get your dog to the vets as soon as you can to try and find the cause of your dog's pain.