Dear Sharon,
As-salamu alaykum
Despite being created as communities (ummah) much in the same manner as humans with all that such an understanding may entail, the Quran does not elaborate what will happen to animals when they are brought back to Him (6:38) and how they may or may not be tested / held accountable. God knows best.
Also, there are animals created today in the depths of the earth such as in the sea and even before humans roamed the earth (such as dinosaurs) which arguably have no use to man. Why they were / have been created and what their purpose is / was within their communities is in God's wisdom.
In my humble view, we should rely on clear matters of guidance which form the bedrock of the Quran and take heed from verses such as 18:22 which teaches us this concept (zahr).
018:022 (Part)
"Enter not, therefore, into controversies concerning them, except on a matter that is clear (Arabic: Illa miraan zahiran)..."
Regards,
Joseph