And if it were not for Allah checking [some] people by means of others, the earth would have been corrupted, but Allah is full of bounty to the worlds.
The following excerpt is taken from “The Study Quran’ under the commentary of the above verse:
Were it not for God’s repelling people, some by means of others is similar to the message of 22:40, where the destruction of houses of worship is thwarted by this repelling. Here it is the corruption of the earth as such that is averted through this repelling of some by others. Commentators state that God uses good people to repel the effect of evil people, but offer different interpretations as to who precisely repels whom. Some say this refers to the “Substitutes” (abdāl), human beings who are inwardly members of a spiritual hierarchy through which God dispenses grace and protection to the world; they are forty in number, and when one dies, that one is replaced by another person (Q). Others interpret it to mean that the prayerful and the pious are used to repel those who do not pray and are
impious, whose sins would otherwise destroy humanity, or that the obedient repel the evil of the disobedient (Ṭ). In a ḥadīth the Prophet says, “God repels the punishment of the one who does not pray by means of the one who prays, and of the one who does not give alms by means of the one who gives alms, and of the one who does not fast by means of the one who fasts, and of the one who does not make the ḥajj by means of the one who makes ḥajj, and of the one who does not struggle by means of the one who struggles.”
Nasr, Hossein (2015). Study Quran. http://www.islamicweblibrary.com/wp-content/uploads/2020/04/TheStudyQuran.pdf