According to this Microsoft article, so it may be caused by too many documents in the query results.
In this example, if the query is simple, the performance of the CQWP is likely to be good as long as the total amount of items is less than 5000. However, if the query is complex, the CQWP could run into performance problems even when the total amount of items is a few thousand.
I suggest you use content search web part in the classic page and highlighted content web part in the modern page.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.