I think it could be Dog of Flanders (1975, 52 episodes) or My Patrasche (1992, 26 episodes), adaptations of A Dog of Flanders.
This is the plot summary of the original A Dog of Flanders from Wikipedia (emphasis mine).
In 19th century Belgium, a boy named Nello becomes an orphan at the age of two when his mother dies in the Ardennes. His grandfather Jehann Daas, who lives in a small village near the city of Antwerp, takes him in.
One day, Nello and Jehann Daas find a dog who was almost beaten to death, and name him Patrasche. Due to the good care of Johaan Daas, the dog recovers, and from then on, Nello and Patrasche are inseparable. Since they are very poor, Nello has to help his grandfather by selling milk. Patrasche helps Nello pull their cart into town each morning.
Nello falls in love with Aloise, the daughter of a well-off man in the village named Nicholas Cogez. Nicholas doesn't want his daughter to have a poor sweetheart. Although Nello is illiterate, he is very talented in drawing. He enters a junior drawing contest in Antwerp, hoping to win the first prize, 200 francs per year. However, the jury selects somebody else.
Afterwards, he is accused of causing a fire by Nicholas (the fire occurred on his property) and his grandfather dies. His life becomes even more desperate. Having no place to stay, Nello goes to the cathedral of Antwerp (see Rubens' The Elevation of the Cross), but he doesn't have enough money to enter. On the night of Christmas Eve, he and Patrasche go to Antwerp and, by chance, find the door to the church open. The next morning, the boy and his dog are found frozen to death in front of the triptych.
According to Wkipedia, A Dog of Flanders spawns many adaptations. Considering the fact that you watched the anime around 15 years ago, and it was a TV series, it can be either of the series above.