The vet can prescribe a dewormer. If you can, bring the worm to the vet with you so the vet can determine what type of worm it is and prescribe the right type of dewormer. Follow the vet's instructions for treatment. It usually takes a couple of treatments to fully remove the worms and any larvae and eggs.
Pet stores sell dewormers but they are too broad spectrum and may not fully treat the type of worm your cat has.
It depends on the tablet. Some are soft and eaten like a treat. Others are hard so you'll need to poke it into the cat's mouth and have him swallow it or crush the tablet up and mix it into some stinky canned food. If pilling is difficult ask the vet for a liquid dewormer.