How to disable SID (session ID) from the URL in Magento 2?
For example: https://example.com/store/?SID=sfl317buq8ru4uf4a
The SID is a “session ID” and Magento uses SID to trace a user’s activity within the same Magento installation. In normal case, Magento powers one website and one store from the one installation. But, Magento can also power multiple websites with multiple stores from one installation though. The SID permits users to remain logged in while navigating across these websites/stores.
If you have enabled SID function for your Magento store, the SID is sent when accessing catalog URLs so Magento can update the session with the user’s location/state for the current website/store.
If you are not running a multi-website or multi-store environment, you can safely disable the SID on the frontend.
You can simply disable it from Magento Admin panel by using below steps.
Go to the Store >> Configuration >> General >> Web >> Under Session Validation Settings, set SID on Storefront value to No and click on “Save config” button to reflect the changes.

That’s it 🙂
Please cross check it from your end and let me know if you have any further assistance on this.