1) “should you pet a service dog”
Well, that depends on who you are. I pet my service dog all the time, and also my SDIT (Service Dog In Training). They like it when I pet them, and I often pet them just because we both enjoy it, as well as to tell them in a low-key way that they done good in a particular moment or decision point. I firmly believe that service dog handlers should absolutely pet their service dogs. If, however, you are John Q. Random Stranger, you should not pet someone else’s service dog. You should not ask to pet someone else’s service dog. If a service dog handler invites you to pet the service dog, that is OK, but don’t expect it.
2) service dogs vs. pet dogs
The key difference here is that service dogs are trained to assist a person with a disability. This means that in order to have a service dog, you must first acquire a disability. Then, the dog must be trained to perform tasks that help out with that disability. Also, the dog must be capable of handling public situations without being obnoxious and disruptive.
There are a lot of areas where pet dogs and service dogs overlap. For instance, my SD and my SDIT both spend a lot of time being petted (see question 1) and a lot of time cuddling, and chewing bones, and lying on the furniture, and playing games with me and with other dogs. All four dogs are concerned if I am especially wobbly. The difference is that if I am especially wobbly, Beowulf and Sid (well, Sid is working on it) both know how to steady me.
So for example, if you are get panic attacks, you might have a pet dog who is concerned and comes over and licks your hands, and you pet the dog and it helps you refocus and get past it. This dog is a pet dog, who might qualify as an Emotional Support Animal. If your panic attacks are disabling (i.e. they interfere with major life activities), and you have trained the dog to, for instance, spot when you are about to have one and perform a behavior that helps you refocus and not have the panic attack, the dog may qualify as a service dog.
You do not have a right to take a pet animal to places where dogs are not normally allowed, not even an Emotional Support Animal. But a person with a disability does have a right to take a service dog almost anywhere, because they need the dog to help them out.
Which leads to the final distinction: a pet dog is a well-beloved family member, ideally, and friend. A service dog is a vital partner in every-day life.