Nope. They’re not inhaling any cocaine. They’re just locating the scent. Snorting up the cocaine would, I guess, theoretically be possible for a dog. But they’re pretty smart animals and probably wouldn’t think to do anything that weird.
Some people believe that drug-detecting dogs are made to be addicted to the substances. Fortunately, that’s not at all true. The dogs are usually trained with toys. There are plastic tubes created for this purpose. They’re hollow, to be filled with the substance of choice. Because they’re tightly closed, the dogs never interact with the drug itself. They just learn to recognize its scent because that’s what their favourite toy smells like.