Objective To explore the effects of sodium-glucose cotransporter 2 (SGLT 2) inhibitors and glucagon-like peptide-1 (GLP-1) receptor agonists on renal function in type 2 diabetic patients with infection. Methods One hundred and twenty type 2 diabetic patients with infection treated in Jinan Second People's Hospital from January 2020 to January 2023 were selected and randomly divided into a control group and an observation group by lottery, with 60 cases in each group. There were 23 males and 37 females in the control group; they were (55.23±5.46) years old. There were 26 males and 34 females in the observation group; they were (54.87±4.98) years old. Both groups maintained primary hypoglycemic therapy and received anti-infection treatment. Before and after the treatment, fasting plasma glucose (FPG), glycated hemoglobin A1c (HbA1c), 2-hour postprandial blood glucose (2hPBG), the insulin resistance index (homeostatic model assessment of insulin resistance, HOMA-IR), levels of total cholesterol (TC), triglycerides (TG), low-density lipoprotein cholesterol (LDL-C), and high-density lipoprotein cholesterol (HDL-C), the clearance rates of positive bacteria, and the changes in renal function-related indicators were compared between the two groups. Before the treatment, there were no statistical differences in the blood glucose levels and HOMA-IR between the two groups (all P>0.05). After the treatment, the FPG, HbA1c, 2hPBG, and HOMA-IR decreased in both groups, and those in the observation group were lower than those in the control group [(6.51±0.96) mmol/L vs. (7.73±0.52) mmol/L, (5.95±0.72)% vs. (7.80±0.67)%, (7.90±0.74) mmol/L vs. (13.57±1.86) mmol/L, (2.56±0.33) mmol/L vs. (3.15±0.29) mmol/L; t=8.656, 14.570, 22.146, and 10.403; all P<0.05]. Before the treatment, there were no statistical differences in the serum lipid levels between the two groups (all P>0.05). After the treatment, the levels of TC, TG, and LDL-C decreased and the HDL-C level increased in both groups, and the levels in the observation group were better than those in the control group [(4.98±0.95) mg/dl vs. (5.36±1.02) mg/dl, (1.66±0.31) mg/dl vs. (1.88±0.34) mg/dl, (1.89±0.45) mg/dl vs. (2.77±0.77) mg/dl, and (1.13±0.22) mg/dl vs. (1.02±0.14) ; t=2.112, 3.704, 7.643, -3.267; all P<0.05]. Before the treatment, there were no statistical differences in the levels of renal function indicators between the two groups (all P>0.05). After the treatment, the levels of β2 microglobins, cystatin C, blood creatinine, and blood urea nitrogen were higher than those before the treatment in both groups, and the levels in the observation group were lower than those in the control group [(1.55±0.13) mg/L vs. (1.62±0.21) mg/L, (1.32±0.34) mg/L vs. (1.49±0.24) mg/L, (94.42±9.62) mg/L vs. (97.54±8.96) mg/L, (5.36±2.34) mg/L vs. (5.54±2.41) mg/L. There was no statistical difference in the incidence of adverse reactions between the two groups (P>0.05). Conclusion Both SGLT 2 inhibitors and GLP-1 receptor agonists for type 2 diabetic patients are effective, have glucose- and lipid-lowering effects, and can protect renal function, but SGLT 2 inhibitors is better.