Hi @Talha
For inbound spam filter, you may consider the scenario for using a third-party cloud filtering service with Microsoft 365 or Office 365.
And Use Enhanced Filtering for Connectors (highly recommended): Use Enhanced Filtering for Connectors (also known as skip listing) on the Partner inbound connector that receives messages from the third-party application. This allows EOP and Microsoft 365 Defender for Office 365 scanning on the messages for a double anti-spam check.