This study explored heterogeneous treatment effects (HTEs) of the real‐world use of dipeptidyl peptidase‐4 inhibitors (DPP‐4is) vs. sulfonylureas (SUs) on cardiovascular diseases (CVDs) and mortality in patients with type 2 diabetes. Utilizing Taiwan’s National Health Insurance Research Database, 19,853 propensity score‐matched pairs of DPP‐4i and SU stable users were identified. Classification and regression tree analyses and Cox models were applied to explore HTEs, according to various patient characteristics, on the composite CVDs, three‐point major adverse cardiovascular event (MACE), and all‐cause mortality. The absolute risk difference (ARD), hazard ratio (HR), and 95% confidence interval (CI) were estimated for comparing treatment effects. CVD history, ischemic stroke, or transient ischemic attack (IS/TIA) history, and age at treatment initiation were significant treatment effect modifiers. Patients with prior IS/TIA but without any other prior CVDs benefited most in reduced risks of composite CVDs from using DPP‐4i vs. SU (ARD −4.31%, 95% CI −7.48% to −1.14%, HR 0.81, 95% CI 0.69 ~ 0.95), followed by those without prior IS/TIA and CVDs and initiated with DPP‐4i at age < 69.3 years (ARD −0.90%, 95% CI −1.47% to −0.32%, HR 0.86, 95% CI 0.77 ~ 0.97). Patients with prior IS/TIA benefited most in reduced risks of three‐point MACE from using DPP‐4i vs. SU (ARD −4.22%, 95% CV −6.66% to −1.78%, HR 0.80, 95% CI 0.69 ~ 0.93), followed by those without prior IS/TIA and initiated with DPP‐4i at age < 69.3 years (ARD −0.68%, 95% CI −1.08% to −0.29%, HR 0.81, 95% CI 0.70 ~ 0.93). Consideration of CVD and IS/TIA histories and age could facilitate individualized diabetes management of using DPP‐4i vs. SU. Future studies are warranted given the hypothesis‐generating nature in this exploratory research.