Praise be to Allah, and peace and blessings be upon the Messenger of Allah and his family.
According to Islaamic Shareeah, it is not permitted to keep a dog except within narrowly-defined limits, as the Prophet (peace and blessings of Allah be upon him) explained: "Whoever keeps a dog, his good deeds will decrease every day by one qeeraat (a unit of measurement), unless it is a dog for farming or herding." According to another report: ". . . unless it is a dog for herding sheep, farming or hunting." (Reported by al-Bukhari, al-Fath, 2322)
Dogs are extremely naajis (impure, unclean). The Prophet (peace and blessings of Allah be upon him) said: "If a dog drinks from the vessel of any one of you, let him wash it seven times" (reported by Muslim, no. 279). According to another report: ". . . and clean it the eighth time with earth." (Saheeh Muslim, no. 280).
It is forbidden in Islaam to sell a dog and to receive payment for it, as is reported in Saheeh al-Bukhari from Abu Masoud al-Ansaari: the Messenger of Allah (peace and blessings of Allah be upon him) forbade (accepting) the price of a dog. (al-Fath, no. 2237)
The Prophet (peace and blessings of Allah be upon him) told us not to resemble dogs by placing our forearms on the ground during sujood (prostration), as in reported in the hadeeth narrated by Anas ibn Maalik, according to which the Prophet (peace and blessings of Allah be upon him) said: "Do sujood properly; none of you should spread his forearms like a dog does." (al-Bukhari, Fath, no. 822).
Whoever keeps a dog in his house is denied the blessing of the angels presence in his house, as the Messenger of Allah (peace and blessings of Allah be upon him) said: "The angels do not enter a house in which there is a dog." (Reported by al-Bukhari, 3225).
Keeping dogs nowadays is the habit of the kuffaar, who adopt them as friends, kiss them, let them lick them and their clothes, sleep with them and even leave them money in their wills. Keeping a dog is an imitation of the kuffaar. Some Muslims may claim that they need to keep a dog at home for purposes of protection, to which we respond that nowadays there are burglar alarm systems and other measures one may take for security purposes, and there is no need to keep a dog, praise be to Allah.
It only remains for us to say that the fact that it is forbidden to keep a dog and interect closely with it does not mean that we should not be kind or feel compassion towards dogs if we see them in a pitiful state. These are two entirely separate matters. The Prophet (peace and blessings of Allah be upon him) told us that "a man saw a dog biting the dust because of thirst, so he took his shoe and started to scoop water up with it until the dogs thirst was quenched. Allah appreciated his good deed and granted him entry to Paradise for it." (Reported by al-Bukhari, no. 174).
According to another report, the Prophet (peace and blessings of Allah be upon him) said: "Whilst a man was walking he became very thirsty, so he went down to a well and drank from it. When he came out, he saw a dog panting and biting the soil because of thirst. The man said, He is suffering the same as I suffered, so he filled his shoe (with water), came out and let the dog drink until his thirst was quenched. Allah appreciated his good deed and forgave him because of it." The people asked, "O Messenger of Allah, will we be rewarded for how we treat animals?" He said, "In every living thing there is a reward." (Reported by al-Bukhari, Fath, no. 2363).
We do not want to omit reminding you of the importance of reading the Quran properly and referring to it. You say in your question that the story of the thirsty dog is in the Quran, and that is not the case, as it is reported in the Sunnah.
And Allah knows best.