As a bit of a sidenote, which won't help you but hopefully can prevent someone's dog from ending up in this situation; this is why I prefer to keep a properly fitted collar with a name tag with current contact information on the dog at all times. No responsible pet owner wants for their pet to run off, but accidents still happen and can happen in a second. There's a small risk that the dog can get the collar caught in something, but that risk is minimized by ensuring that the collar is properly fitted. You can also consider a "breakaway" safety collar. Use a fixed-length collar that is comfortable and safe for the dog to wear; choke or slip-on collars, martingales, training collars, prong collars, etc., should not be used!
That said, in the situation you're in, the first step is one you largely have already taken: ensure that the dog is safe.
Once the dog is safe, you need to try to identify the dog's owner in order to be able to get in touch with them. Some good places to start are:
If the dog is wearing an ID tag that includes a phone number, call that phone number first. If the ID tag lists more than one phone number, make sure you try all of them, ideally in the order they are listed (there's probably a reason why the owner put them in the order that they did). It's highly likely that the owner either (a) hasn't yet even realized that their dog has run off, or (b) is frantically searching for their dog. In either case, a phone call from someone who can provide an address where the dog is at and assurance that the dog is safe until they can get there will be a life-saver for them. If the dog doesn't want to let you read the tag on it, you can make the situation less threatening by taking a photo of the tag from a bit of a distance and instead reading the details from the photo.
- As appropriate for your general area, contact nearby veterinary clinics, animal control, possibly the police, any nearby rescues, and nearby dog training clubs. Keep in mind that dogs can run far, and the owner might not go to the place closest to where the dog lives for things like veterinary care or classes, so "nearby" is relative. Inquire as to whether anyone has reported a lost dog. Leave a brief description of the dog (approximate size and color can go a long way, with further details a bonus; something like "it's a female, about the size of a German Shepherd, white with large black spots, short tail") along with your contact details, in case the owner calls in. Some dogs have an ID number tattooed to the inside of one ear; if the dog will let you examine it enough to read such an ID, even partially, then include it in the description you leave, but if it's unwilling, don't push it. The dog is likely stressed out enough already; don't make it worse unless you absolutely must! (Hint: you probably don't need to.) Contacting either animal control or the police may also be a required step if you later decide to claim the dog if no owner can be identified.
Check local groups on social media to see if there are any relevant posts. If there is, say, a local "missing dogs" group, that's an excellent place to post a notice yourself if you don't find anything that appears to be for the dog you've found. Include a photo of the dog if you can, but don't beat yourself up too badly if for whatever reason you can't.
- If you are able, determine whether the dog has an ID microchip. Veterinary clinics will have equipment to read the microchip number for whatever type of microchips are used in your area; rescues, police, and other places that regularly deal with dogs might also have chip readers available. The chip number itself won't tell you anything, but vet clinics in particular will very likely have the chip number noted for dogs that are patients with them (even just for vaccinations), so once you have a chip number for the dog, if you couldn't tell them initially what it was, contact them again and provide the chip number. They will be able to match this against their records and find contact details for the owner if the dog has ever been a patient with them; although they very likely can't share those details (or even the fact whether or not they have the dog on file) with you, they will be able to contact the owner and pass along your contact details to the owner if they do. There may also be online databases that allow you to map the chip number to an owner, or even just the dog's identity; the national kennel club in your country can be a good place for this, once you have a chip number. For purebred dogs, the national kennel club will very likely have the breeder's details even if they don't have the owner's details; the breeder, in turn, if reputable, is likely to have contact information for their puppy buyers, although perhaps not immediately accessible.
- Look to see if there are missing-dog flyers posted in the neighborhood. Some owners have the presence of mind to prepare flyers ahead of time in case they are ever needed.
Especially if/when you post something yourself, whether online or offline, refrain from speculating. State facts, but don't, for example, claim something about the dog unless you are absolutely certain that the claim is correct (and in some cases not even then); for example, that the dog is some particular breed. As just some examples of that, particularly in the absence of a photo, the owner who is desperately looking for their Karelian Bear Dog or Siberian husky might not stop to consider that the post about a border collie in the next town over might be their dog (and certainly others who otherwise might be able to help or draw possible owners' attention to them might think it doesn't even apply), and likewise for someone who has lost a Kishu seeing something about a white shepherd or the Tervuren owner seeing something about a German Shepherd. It's easy enough to avoid this risk by simply not making such statements in the first place; instead, simply put something like "black and white female dog" or "brown and black male dog".
Also, once you do get in touch with the owner, even though the owner is likely to be very emotional at that point, I would really encourage you to do one more thing.
Ask to check the owner's ID and note down identifying information for who you are turning the dog over to, and when. If you can also take a photo of the two of them together, that's even better.
In the unlikely event that someone is taking the opportunity to get a free dog from someone who doesn't know who is the rightful owner of the dog, doing so will at least allow you to provide anyone trying to follow up on the incident the likely identity of the person who took possession of the dog.