That is easy where the dog is wearing a collar and tag inscribed with the owner's details but many owners fail to comply with this.
It is acceptable to have the dog scanned for a microchip at the nearest vets and contact the owner by this means, but generally the routine is to report it to the local authority dog warden service. The dog warden will attend and scan the dog. First offenders will have the dog returned to them where possible. Serial offenders' dogs, or in the case of no chip or non-response to telephone calls, will be brought into the care of whichever facility holds the local authority contract for looking after strays during the statutory seven-day period allowed for an owner to reclaim. In Dumfries and Galloway, this is us.
Dumfries and Galloway Council dog wardens only operate a collection service during office hours at present, and although the police no longer have a statutory obligation to deal with strays, some of the police stations will still accept them for the council out of hours.
If the finder of a dog wishes to offer it a permanent home should the owner not come forward, there are two options. They may keep the dog, having registered the fact they are holding it, but they must not pass it on for a period of at least 60 days in Scotland (30 days in the rest of the UK) There is a grey area in this piece of legislation, as the owner may turn up at any time after the prescribed period and may successfully seek through the courts to have his dog returned, although he will be required to repay the finder all reasonable expenses incurred whilst caring for it. It is more clear-cut therefore to hand the dog over to the care of the local authority facility, and apply to adopt it after the seven day period has been served - the law quite clearly states that after seven days the original owner loses ownership rights.
Please note that once you have taken possession of a stray dog, it is an offence to turn it loose again. You may have to keep hold of it until the dog warden can collect.
Finally a special word of warning. Local Missing Pets Facebook groups often attract the wrong sort of people trawling for bait. Be VERY careful that you don't hand over the dog to someone claiming to be the owner without first establishing identity and verifying ownership. An owner will have photos, vet history etc etc. If in doubt, get advice. We are always happy to help.