Anytime you have a sudden behavioral change a vet visit is in order.
Once you know where you stand from a health perspective you can then start thinking about behavior. When starting with a puppy, it is important to touch them lots during all sorts of situations. My dogs grow up being touched when they are asleep, petted, nudged, tapped, etc so it is really just routine. If you are starting with an adult or adolescent, say their name first so they are not startled even give a treat while touching them so they know that being touched means good things. You can also start hand feeding some or all of their meals where you have one hand touching them somewhere while you feed with the other hand so they start associating touch with "good things".