If the fish are still eating, the best meds for this would be administered in the food. If they are not eating, you need to get ones that are absorbed through the skin. Either way tho, I would not do it in the main tank. You want to be able to see the parasite bodies to confirm that was the issue. You can't really do that effectively in a tank with substrate.

You also need to be more exact in the dosing. Most meds are prepackaged in doses for 10 gals of water. A 10
gal tank does not hold 10 gallons of water however. So you would either need to use a larger volume tank where you have measured out exactly where 10 gallons of water is in the tank or if the fish are small enough, measure out 5 gals of water and 1/2 of the dose ( if it's measured for 10 gals.) Use either a piece of tape or a magic marker to mark the water line so that you won't have to do it again in the future ( should you need to.

) You can see how I did it in this pic
Aquarium Advice - Aquarium Forum Community - Andy Sager's Album: Breeding Bettas - Picture
As for dosing, I use plastic measuring spoons I get at the dollar store. Measure the whole package and divide in half ( again assuming a 10
gal dose and you are using 5 gals of water.)
Hope this helps