Hi-Yield Vegetable & Ornamental Insect Control Granules will kill earthworms and other benficials should they come in contact with it.
Hi-Yield Vegetable & Ornamental Insect Control Granules is not labeled for root vegetables and we would not recommend it for onion maggots. Pyganic Gardening would be a product you could use though it is more of a contact kill and leaves no residual Malathion 57% is another option.
Hi-Yield Vegetable & Ornamental Insect Control Granules  may harm honeybees and  other benficials should they come in contact with it. To minimize contact, apply in the early morning or in the evening when bees are least active, and avoid applying to any flowering vegetation.