And Allah judges with truth, while those they invoke besides Him judge not with anything. Indeed, Allah - He is the Hearing, the Seeing.
والله يقضي بالحق والذين يدعون من دونه لا يقضون بشيء إن الله هو السميع البصير [Ghafir 40:20]
And Allah judges with truth: This clause is conjoined to His saying:
He knows
يعلم
and He judges with truth, meaning He rules by it in both legislation and decree, because judgment, I mean the judgment of Allah the Mighty and Majestic, is of two types:
Cosmic judgment, as in His saying the Exalted:
And We conveyed to the Children of Israel in the Scripture that, "You will surely cause corruption on the earth twice, and you will surely reach [a degree of] great haughtiness.
وقضينا إلى بني إسرائيل في الكتاب لتفسدن في الأرض مرتين ولتعلن علوا كبيرا [Al-Isra 17:4]
and legislative judgment, as in His saying the Exalted:
And your Lord has decreed that you not worship except Him
وقضى ربك ألا تعبدوا إلا إياه [Al-Isra 17:23]
So here, Allah says He judges with truth. Is the intended meaning cosmic judgment or legislative judgment? The intended meaning is both, meaning that He judges with cosmic judgment by truth, so there is no futility or play in His cosmic judgment
(38) And We did not create the heavens and earth and that between them in play. (39) We did not create them except in truth, but most of them do not know.
وما خلقنا السماوات والأرض وما بينهما لاعبين ما خلقناهما إلا بالحق [Ad-Dukhan 44:38-39]
and likewise He judges with legislative judgment by truth, so His legislative judgment, Blessed and Exalted is He, is all truth, because it is good, so He commands it, or evil, so He forbids it, and this is the truth. So Allah judges with truth in both types: cosmic judgment and legislative judgment. Now,
And those they call upon besides Him
والذين يدعون من دونه [Ar-Ra'd 13:14]
the waw here is a conjunction, and it is permissible for it to be introductory.