If all the mailboxes and any public folders are in 365, then close that firewall port ( and all https access) to the on-prem Exchange Servers as soon as possible.
Its not needed and is a security risk.
If all your mail flows inbound and outbound through 365, be sure to block port 25 to the on-prem servers as well if that is open.
Verify that autodiscover points to Exchange Online
https://learn.microsoft.com/en-us/exchange/decommission-on-premises-exchange
https://learn.microsoft.com/en-us/exchange/decommission-on-premises-exchange