I'd say, "HEY! What do you think you're doing? We don't disrespect other people's property like that! That's disgusting! How would you like to be walking across the yard and you get someone's lugee all over your foot? That'd be gross! Next time, swallow it or go spit in the bathroom sink where other people won't see or step on it, OK?"
If a younger child did it again, I'd assume a dental problem and check into that. If an older child disregarded me, I'd probably assign work beautifying property like pulling weeds, mowing an elderly neighbor's lawn, picking up trash in the neighborhood, etc.
I honestly wouldn't expect it to happen again after that.