A found dog is not necessarily lost or homeless. However, if you have reason to believe that it is, you can help it get back home by taking it to an animal shelter or the police, who can check the database and try to contact the owner.
If you take the dog to a shelter, the shelter must keep it available to its owners for at least 15 days (or 45 days in the case of a foster family). If you wish to keep the dog after it has been identified, you are obliged to return the dog to its owners if they come forward up to 45 days after it was found. After that, you become the legal owner.