SCCM supports supersedence, where a currently deployed application can be replaced with another application, usually a newer version.
NOTE: This is only possible for SCCM applications, not packages.
On how to create a suitable application in SCCM see:
NOTE: For a supersedence application you should set a detailed rule to also check the file version (or other suitable file property) to determine whether the new version of this app is present or not.
Create Supersedence Relationship
Once you have your new application ready and distributed accordingly, you need to create a supersedence relationship between old and new:
Right click your NEW application and choose properties > Supersedence
Choose Add, then browse to your old application you need to replace.
You should see the relationship change as below. NOTE: Make sure you enable the 'uninstall' checkbox to force a clean install of the application.
After this step, the application will be ready for replacement. However a new deployment needs to be created on the new application to begin this process. It is also a good idea to delete any active deployments on the superseded application to prevent unnecessary new installations.
You should first deploy to a test collection with the old app installed (via sccm) to test the removal and re-installation of your new version. Once happy, you can create a deployment to point to the same collection as the previous version.
Once deployment of your new version is going out okay, it's recommended to 'retire' the old version. To do this right click your application > Retire.
This makes the old version of the application unavailable for distribution and makes it obvious to others which one is the active/most recently deployed version.
Microsoft Documentation on SCCM supercedence: