Hi,
In order to narrow down the issue, I would like to know: Which SharePoint version are you using?
In the meantime, I would like to provide below information:
The List View Threshold in SharePoint Online is 5,000 items. However, this threshold is not determined by the number of items displayed in the final result. Instead, SharePoint evaluates how many items must be scanned or processed while executing the query. If more than 5,000 items need to be processed, SharePoint may block the operation even when the final view returns far fewer items.
For reference: "The number of items in this list exceeds the list view threshold" when you view lists in Microsoft 365
To address this issue, Microsoft recommends:
Creating indexes on columns that are frequently used for filtering or sorting.
To create indexed columns in SharePoint, you can follow these steps:
Go to SharePoint site > Open your List > Gear icon > List Settings > Indexed columns > Create a new index > Select the column which is used in Filter function > Save the settings.
Using filtered views that leverage indexed column
For more information about indexing columns, see Add an index to a list or library column.
For more information about filtering columns, see Use filtering to modify a SharePoint view.
Kindly let me know if this is helpful.
Looking forward to hearing from you.