Unable to paginate a custom page query

The problem was in the same name for category slug “categories” and the same for the custom page that was holding all categories with the same name “categories”.

I have solved that by changing categories slug (in permalinks settings) to singular “category” and I have left custom page as plural “categories”.

If somebody know about some better solution, please let me know, thanks.

P.S. I was thinking about deleting this question, however, I think thinks is an interesting problem and maybe somebody will find it helpful. But If any moderator think it’s ot worth of sharing, you can delete this question.