"You think you've got them all out, and then..."
A weed was an undesirable plant in a garden. To compare something to a weed was to imply that it proliferated rapidly and/or was hard to eradicate. Weeds could be controlled with herbicides. (TAS: "The Infinite Vulcan"; TNG: "The First Duty")
Boothby, the groundskeeper of Starfleet Academy in the 24th century, preferred to pull weeds by hand rather than use an herbicide. (TNG: "The First Duty")
In 2371, Furel told Lupaza that he had seen better weeds than the crops she grew. (DS9: "Shakaar")
When Quark attempted to hire Elim Garak as an assassin in late 2372, Garak replied that he had been a gardener and that his services were available should Quark need something weeded. (DS9: "Body Parts")
In early 2374, Lieutenant B'Elanna Torres compared removing Borg technology from the plasma intake manifolds of USS Voyager to pulling weeds. (VOY: "The Gift")
In 2399, William T. Riker told Jean-Luc Picard that Antarean basil grew like weeds around his house. (PIC: "Nepenthe")