The overdose was a reminder of a quiet scourge affecting places around the country that has been overshadowed in recent years by a lethal opioid epidemic. In New York City, years of efforts had been aimed at stamping out drugs like K2, which are made of plant matter that has been sprayed with mind-altering substances that mimic the effect of THC, the active ingredient in marijuana. But eradicating synthetic cannabinoids has been a struggle as their use persists: City hospitals this year have recorded 600 emergency room visits from patients suffering from their use.

New York is one of more than 40 states that have banned the drugs, which are commonly called synthetic marijuana and marketed under designer names like Spice, Green Giant Scooby Snax and Mr. Bad Guy. The Drug Enforcement Administration has banned more than two dozen substances used to make them. In New York City, subway posters warn that the drugs contain no marijuana and are potentially deadly.

“While the packaging may look uniform and professional,” said Dr. Edward Fishkin, the chief medical officer of Woodhull Medical and Mental Health Center, “the contents may vary wildly in dosage and potency, which can result in a sudden wave of users needing emergency care.”

The drugs remain difficult to stamp out, in part because their makeup is constantly changing, a problem that also makes it difficult to assess how dangerous they are, experts said. There are also divisions with among policymakers and the public over how to combat their use without criminalizing drug addiction.

“These are synthetic drugs that are manufactured with remarkable creativity such that lawmakers are facing challenges in keeping ahead, said Eugene O’Donnell, a professor at the John Jay College of Criminal Justice and a former New York City police officer. “Restricting access to one ingredient touches off a search for a replacement. If you can whip up an intoxicating or stimulating substance readily and legally available, you can avoid prosecution.”

The incident on Saturday was at least the second mass overdose near the intersection, which is on the border of Bedford-Stuyvesant and Bushwick. In July 2016, 33 people overdosed on a similar substance in the same area.