How can we optimize the use of drugs against parasites to limit the evolution of drug resistance? This question has been addressed by many theoretical studies focusing either on the mixing of various treatments, or their temporal alternation. Here we consider a different treatment strategy where the use of the drug may vary in space to prevent the rise of drug-resistance. We analyze epidemiological models where drug-resistant and drug-sensitive parasites compete in a one-dimensional spatially heterogeneous environment. Two different parasite life-cycles are considered: (i) direct transmission between hosts, and (ii) vector-borne transmission. In both cases we find a critical size of the treated area, under which the drug-resistant strain cannot persist. This critical size depends on the basic reproductive ratios of each strain in each environment, on the ranges of dispersal, and on the duration of an infection with drug-resistant parasites. We discuss optimal treatment strategies that limit disease prevalence and the evolution of drug-resistance.