Abstract Background Dirofilaria immitis and Dirofilaria repens are vector-borne zoonotic parasites which affect mainly dogs and humans worldwide. In Iran, information about the distribution of those nematodes is scant in several regions. Therefore, we investigated the prevalence of these filarial parasites in stray dogs from five Iranian provinces where no information about these parasites is available. Methods Blood samples were collected from 344 stray dogs in five provinces of Iran (i.e. Mazandaran, Gilan, Esfahan, Qazvin and Loresan). The presence of microfilariae was assessed using direct smear, modified Knott’s test, molecular detection of filarial DNA (cox1 gene) and Wolbachia endosymbiont of parasitic nematodes (ftsZ gene) by conventional PCR (cPCR). All of the PCR products were sequenced and phylogenetic analysis was performed. Results In total, 75 dogs (21.8%) were found to be positive for D. immitis by cPCR. Infection was detected in all provinces, with the highest prevalence in Gilan province (22/28; 78.6%). Acanthocheilonema reconditum was diagnosed in five dogs (1.4%) from three provinces (i.e. Esfahan, Mazandaran, Gilan). Two dogs were infected with both parasites and three were only infected with A. reconditum. Dirofilaria repens infection was not found in the examined population. Representative sequences of the D. immitis cox1 gene from dogs from the northern provinces (Mazandaran, Gilan, Qazvin) were grouped together and distinctly separate from the ones from western and central provinces (Lorestan and Esfahan), suggesting that different nematode populations are present in the country. Conclusion The data reported herein fill existing gaps in knowledge about canine filarial infection in two Iranian provinces and record the highest prevalence of D. immitis ever reported in the country (i.e. 78.6%). A geographical review of the literature about Dirofilaria spp. and A. reconditum infections in dogs and humans has also been summarized, indicating that D. immitis and D. repens are distributed in 22 of 31 provinces in Iran, whereas A. reconditum is present in fewer regions. Effective control strategies are advocated for owned dogs, and a national program for the management of stray dogs is needed to minimize the risk of infection in animals and humans. Graphical Abstract