First off, is it a tape worm or a roundworm? Both can be thrown up, and cam look an awful lot alike. Stick it in a plastic bag and save if you aren't 100% positive as to what it is. Keep it in the fridge until you can get ahold of the vet and bring it in for him to do an ID on it. If you've already thrown it away, you'll need a fresh stool sample for the vet to do a parasite test on. With the worm in a bag, you won't have to pay for the stool test.
Deworming meds don't cost much, and are relatively easy to give. Depending on the worm, it'll either be a pill or liquid, and you may have a choice as to which. You can probably even bring your cat in and ask one of the techs to admister it if you don't feel up to the task.
At least you found it that way... When I had foster kittens, the worms crawlled out the other end.
Oh, and a little bit of info: worms can cause all kinds of gastrointestanal problems like vomiting and diarreah. It can also cause the cat to loose weight and not get enough minerals and vitamens to stay healthy. Roundworms arand tapeworms can be passed onto humans, so make sure to wash your hands after handling the cat. If there's worms, there's a good chance that there are fleas because the eggs need to be digested by fleas before they hatch, ie. the cat has to eat an infected flea first.