All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Islam encourages treating animals kindly. Islam even orders us to be kind to harmful animals by killing them in a good manner.
Abu Hurayrah narrated that the Prophet said: “He who killed a gecko with the first stroke, for him is such and such a reward; and he who killed it with a second stroke, for him is such and such reward less than the first one; and he who killed it with the third stroke, for him is such and such a reward less than the second one.” [Muslim]
The Prophet also said: “If you kill, do it in a kind and appropriate manner, and if you slaughter, do it in a kind way.” [At-Tirmithi]
As for the harmless animals, there are sound texts urging to treat them kindly.
Abu Hurayrah narrated that the Prophet said: “A man saw a dog eating mud from (the severity of) thirst. So, that man took a shoe (and filled it) with water and kept on pouring the water for the dog till it quenched its thirst. So Allah approved of his deed and made him to enter Paradise.” [Al-Bukhari and Muslim]
So, treating animals including cats and dogs (that are lawful in the Sharee’ah; i.e., dogs for hunting or for guarding, is lawful.
But the person should beware of their impurities. If he feels that some impurity has touched his clothes – like the urine of the dog or its saliva, or touching the dog's skin while wet, then if any such impurity touches his clothes, he should clean them seven times, one of which should be with sand. As for the cat, its saliva is pure, unlike its urine and its excrements, which are not.
For more benefit on veterinary treatment of dogs, please refer to Fatwa 83701.
Allah knows best.