"Those whom they call upon seek the means of approach to their Lord," meaning: closeness. The interpretation of Ibn Mas'ud: He said: It was revealed regarding a group of Arabs who used to worship a group of the Jinn, then the Jinn accepted Islam, but those Arabs were unaware of that. God said: "Those whom they call upon," meaning: the Jinn who are worshipped, "seek the means of approach to their Lord, which of them is nearer," to the end of the verse.
Muhammad said: "Which of them is nearer," (which) is in the nominative case as an initial subject (mubtada'), and the predicate is (nearer). The meaning is: They seek the means of approach to their Lord and observe which of them is nearer to Him; meaning: through righteous deeds, they are nearer to Him and seek approach through him.