This is one of the limitation of SharePoint online.
When a list, library, or folder contains more than 100,000 items, you can't break permissions inheritance on the list, library, or folder. You also can't re-inherit permissions on it. However, you can still break inheritance on the individual items within that list, library, or folder, up to the maximum number of unique permissions in the list or library (see the next section).
Source: Items limit in lists and libraries
For large lists, design to have as few unique permissions as possible and remain below 5,000 in total.
Source: Unique security scopes per list or library
To learn more about other restrictions for viewing large lists, see Manage large lists and libraries in Office 365.