You're doing the right thing, but it's not the legal thing. The owner, no matter how neglectful they are, has a right to their dog. It's their property. As for the vet bills you paid, the owner can say that there was no "consideration" or agreement for them to pay you for those bills. The owner can sue you to get their property back, so hopefully they won't.
PLEASE READ THIS BEFORE YOU COMMENT, EMAIL ME OR PHONE ME. I'm only licensed in CA. This answer doesn't make me your lawyer, and neither do follow-up comments and/or emails and/or phone calls, and you shouldn't expect me to respond to your further questions if you haven't hired me. We need an actual agreement confirmed in writing before any attorney-client relationship is formed. This answer doesn't constitute legal advice, and shouldn't be relied on, since each state has different laws, each situation is fact specific, and it is impossible to evaluate a legal problem without a comprehensive consultation and review of all the facts and documents at issue.
You are assuming that the owner did not properly care for the dog - that may not be true. If the dog has been missing for some time, then it is possible that his condition is from his length of time away from home, not because of anything the owner did or did not do.
While I agree that you cannot keep property from its rightful owner you have no obligation to turn the dog over to just anyone that says they own him. Make them prove they own the dog - vet records, tags, pictures, etc - before you just hand him over. I would also require payment for all bills before handing the dog over. If it comes down to a court fight, you can say that you were treating it as a bailment and you might be able to argue that the Agister's Lien is broad enough to cover this situation.
If we do not have a signed fee agreement I am not your attorney and this is not legal advice.