Use the Upgrade property.
Assuming
<Product Version="1.0.0.0" />
and
<Upgrade Id="GUID">
<UpgradeVersion OnlyDetect="no" Property="OLDERFOUND" Maximum="1.0.0.0" IncludeMaximum="no" />
<UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND' Minimum="1.0.0.0" IncludeMinimum='no' />
<UpgradeVersion OnlyDetect='yes' Property='SAMEFOUND' Minimum="1.0.0.0" Maximum='1.0.0.0' />
</Upgrade>
The first upgradeversion finds all versions upto the current one
the second line finds all versions above the current one
the third line finds installed versions the same as the current one
Then use a custom action like so
<CustomAction Id='NewerFound' Error='A later version of [ProductName] is already installed' />
<InstallExecuteSequence>
<Custom Action='NewerFound' After='FindRelatedProducts'>NEWERFOUND</Custom>
<RemoveExistingProducts After="InstallInitialize" />
</InstallExecuteSequence>
etc
The custom actions shown either removes the older version automatically or it warns the user that a newer version is already installed, but if you want to prompt the user then you can show your custom UI instead of running the CAs.
Personally I just use the first two upgradeversion lines. This does the automatic upgrade if an older one is found, shows the user an error if there is a newer one and, if the same one is installed it shows the user an error ( it does that by default it doesnt require the third line), however this doesnt give you the UI like you want, so as I said above try replacing these CAs with your UI.