Deworming dog

I know this is a weird question to ask sorry in advance but can anyone tell me, I have 3 dogs and took one to the vet and she didn't have worms as far as I'm aware but the vet still went ahead and told us to give her a dewormer or whatever. Do you think it's okay that I give the rest of the package to my other two dogs? I feel like it's kind of pointless to give it to one dog but not the others..even if they don't have any?? I'm only asking cuz I of course don't wanna put my dogs in harm...