You cannot just target one group of people on welfare/benefits, if someone where to set up a system of testing for drugs you would be spending a lot of money, there are various things you need such as
Staff, someone needs to arrange all appointments, ensure people attend, track those down who do not, there simply would not be enough current staff to do this over a relatively short amount of time. Not only do these staff need training and somewhere to actually work, they need thorough training.
Drugs tests, who is going to carry them out? Will a centre be built/hired for those on benefits, or will those carrying out tests individually visit the homes of those on welfare? Both options cost a lot of money.
New managers to over see this process in small areas will be needed, they'll be costly.
Financial services, either a new branch of accountants will need to be employed, or diverted from elsewhere and retrained.
There are legal drugs you can take which mean you would fail a drugs test, but produce the bottle and the test has to be ignored, you cannot simply access a persons medical records and you cannot ask a GP what they have prescribed to a person. Those who are on drugs will soon realise by buying some legal drugs, they can produce their medication to effectively pass their drug test and carry on receiving money.
Are those who receive benefits able to receive rehabilitation treatment? Or aren't they deemed worthy enough?
Now, lets go through the most likely scenario of a drug addict (who is unable to think straight) having their income removed, firstly they may start stealing to pay for their drug habit, soon after they will be evicted. That will lead to more crime, not only will they now need drug money, but also need to steal for food etc. In women, the largest cause of prostitution is to fund a drug habit. Now, theft and prostitution, these often lead to prison, now I know for a fact the cost of someone to go through court and then remain in prison for a year, costs far far more than being on benefits for one year.