Weed killers work in a number of different ways. "Herbicides can act by inhibiting cell division, photosynthesis or amino acid production or by mimicking natural plant growth hormones, causing deformities." https://www.epa.gov/caddis-vol2/herbicides
If you spray part of a plant you didn't want...