If you give money to a homeless person on the street, and they use that money to buy alcohol or other intoxicants (drugs), can what you give be considered charity, since it did not help that person in any way? Would the scenario differ if you witnessed him buy the alcohol with the money versus if you had no idea if they did?
Rabbi Goldberg translated Shulchan Aruch Yore Deah: The Laws of Tzedakah and quotes:
Siman 250 : How much is Proper to Give to Each Poor Person
1) How much do we give to a poor person – whatever the poor person is lacking. How so? If the poor person is hungry, then we feed him. If he lacks proper clothing, then we clothe him. If he lacks household utensils then we purchase them for him.
(Rabbi Goldberg notes that this applies to those in charge of communal Tzedakah or to the public in general. However an individual is not obligated to provide all that is stated above on his own.)
From this we see that we have to attend to the needs of the potential recipient. If the poor person will certainly use your donation for harmful purposes, those are not "his needs" as referred to above and it may very well not be tzedaka.
Note that the Shulchan Oruch speaks about delivering the needs directly instead of with money. Giving the tzedaka in kind will obviate the problem.
Most times, however, we cannot be certain of the needs of the poor person and there is a danger that we will miss out on doing the mitzva of tzedaka. As this article writes,
According to Torah law, giving to the needy is a mitzvah—a commandment and a good deed. This means that, on the one hand, it is not an arbitrary act, but a duty and an obligation. On the other hand, it is a good deed—a credit to the one who recognizes his duty and carries out his obligation.
And in the words of our sages: “More than the rich man does for the pauper, the pauper does for the rich man.”
To sum up:
To be tzedaka, it must meet the needs of the poor person.
Gifts in kind can ensure it is genuine tzedaka.
Try hard not to lose out on the mitzva.
If you give an addict the resources to indulge their unhealthy addiction, it's not only not tzedaka, it's likely a violation of the prohibition of "lo titein michshol" ("Before the blind put not a stumbling block") or at least "mesayea yedei ovrei aveira" (aiding sinners).