There is a new tool to help battle the opioid epidemic that works like a pregnancy test to detect fentanyl, the potent substance behind the escalating number of deaths roiling communities around the country.

The test strip, originally designed for the medical profession to test urine, can also be used off-label by heroin and cocaine users who fear their drugs have been adulterated with the synthetic opioid fentanyl. The strips are dipped in water containing a minute amount of a drug and generally provide a result within a...