In recent years, the rapid advancement of digital technology has supported the growth of the digital economy. The transformation towards digitization in the public health sector serves as a key indicator of this economic shift. Understanding how the digital economy continuously improves the efficiency of public health services and its various pathways of influence has become increasingly important. It is essential to clarify the impact mechanism of the digital economy on public health services to optimize health expenditures and advance digital economic construction. This study investigates the impact of digital economic development on the efficiency of public health services from a novel perspective, considering social media usage and urban–rural healthcare disparities while constructing a comprehensive index of digital economic development. The findings indicate that the digital economy reduces the efficiency of public health services primarily through two transmission mechanisms: the promotion of social media usage and the widening urban–rural healthcare gap. Moreover, these impacts and transmission pathways exhibit spatial heterogeneity. This study unveils the intrinsic connection and mechanisms of interaction between digital economic development and the efficiency of public health services, providing a theoretical basis and reference for government policy formulation. However, it also prompts further considerations on achieving synergy and interaction between the digital economy and public health services.