The distributed lag non-linear (DLNM) model has been frequently used in time series environmental health research. However, its functionality for assessing spatial heterogeneity is still restricted, especially in analyzing spatiotemporal data. This study proposed a solution to take a spatial function into account in the DLNM, and compared the influence with and without considering spatial heterogeneity in a case study. This research applied the DLNM to investigate non-linear lag effect up to 7 days in a case study about the spatiotemporal impact of fine particulate matter (PM2.5) on preschool children's acute respiratory infection in 41 districts of northern Taiwan during 2005 to 2007. We applied two spatiotemporal methods to impute missing air pollutant data, and included the Markov random fields to analyze district boundary data in the DLNM. When analyzing the original data without a spatial function, the overall PM2.5 effect accumulated from all lag-specific effects had a slight variation at smaller PM2.5 measurements, but eventually decreased to relative risk significantly < 1 when PM2.5 increased. While analyzing spatiotemporal imputed data without a spatial function, the overall PM2.5 effect did not decrease but increased in monotone as PM2.5 increased over 20 μg/m3. After adding a spatial function in the DLNM, spatiotemporal imputed data conducted similar results compared with the overall effect from the original data. Moreover, the spatial function showed a clear and uneven pattern in Taipei, revealing that preschool children living in 31 districts of Taipei were vulnerable to acute respiratory infection. Our findings suggest the necessity of including a spatial function in the DLNM to make a spatiotemporal analysis available and to conduct more reliable and explainable research. This study also revealed the analytical impact if spatial heterogeneity is ignored.