How do you obtain all product and collection URLs in a loop?

Hello Everyone,
I have one query can you tell me how we get all product URLs and all Collection URLs in a loop