You are not able to predict who is going to die of an overdose -- let alone because of your gift (ie suggeseting they wouldn't have otherwise, it is your gift that led to that).
So you can decide to treat everyone with dignity as an adult, or nobody with dignity as an adult. You are advocating for nobody (or at least nobody who is on the streets), out of an abundance of 'caution'.
You are mistaken if you think you are helping people by being an asshole to them. But it is certainly your right to do so.
Maybe, maybe not, but claiming the reason you don't give people money is "What is the point of giving someone money so that they can die of an overdose using the drugs you helped them buy?" -- definitely does.
You can treat someone respectfully while giving them money, or while not giving them money; and you can be an asshole either way too.
"This money could help this person, but it's also quite risky, given that the majority of chronically homeless people (most people panhandling) have drug addictions or other mental health issues or both. My money would be better spent on services that can help address these issues over the long term."
I think we disagree on what constitutes an asshole. Being aware of the statistical realities of a situation and operating on them is not being an asshole. If you were to say "of course I'm not giving you money, you're probably addicted to heroin" to someone's face after they ask you for change, that would make you an asshole. But that's not what I'm advocating.