Thank you for your question. Humans are created to reach their perfection as beings that mirror God's most beautiful Names. The path to that perfection is the effacement of the ego by becoming servants of God and the method to reach this goal is worshipping God. Hence when God says that he didn't create humans or jinn except to worship him, it is in terms of the method to reach their perfection and does not imply that He is needful of worship in any way.
May you always be successful.