Per my test, SharePoint Online does not upload a file directly if it is a duplicate submission.
In modern experience, when we try to upload a file with the same filename to a library, it prompts a message to add the new file as latest version of the existing file without uploading it directly.
If we click “Add file”, the file then gets uploaded and overwrites the existing file as a newer version.
Also in classic experience, it offers choices to replace the existing file or quit uploading before it completes this action.
This is the default behavior in SharePoint Online and it is not supported to change the behavior/prompt message for duplicate submissions for the time being.
You are welcomed to share any idea via SharePoint UserVoice Forums to help improve SharePoint products: https://sharepoint.uservoice.com/forums/329214-sites-and-collaboration?category_id=144015
If an Answer is helpful, please click "Accept Answer" and upvote it.
**Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. **