Pyrimethamine is a medication primarily used as an antimalarial and antiparasitic agent. It is also used to treat toxoplasmosis in combination with other drugs. Pyrimethamine works by inhibiting the enzyme dihydrofolate reductase, which is crucial for the synthesis of folic acid in parasites.