Make them actually legal (and thus more safe), tax them heavily, use a portion of said taxation to educate properly and then support and rehabilitate those who need it. Don't allow unsafe activities in public places that cause an unsafe environment.
This really isn't that complicated, we've just been under the spell of prohibition for so long waking up can be a bit disorienting.