@ArturasF the maximum number of items in a SharePoint list is 30 million. The 5000 refers to the list view threshold and the issue is not with storing more than 5000 items but in displaying more than that in a view. It will give you an error message if you go over the threshold. There are plenty of blogs and posts that discuss it so do a search for Sharepoint list view threshold to read up about it.
You might want to consider archiving off each previous month to a different list, perhaps by a using a flow in Power Automate which is what we do on several of our big lists:
Rob Los Gallardos Microsoft Power Automate Community Super User