Overwriting the file would be ok and its file identifier wouldn't change, but when you delete it completely it changes. You have to simply replace the file not delete it, so that it keeps the same reference.
That, or you have to modify your flow so that you dynamically get the files unique Id and plug that dynamic property in.
Option 1 (see option 2 lower down)
Since this is SPO you can use Get Files (Properties Only)
Then use an Apply to each to loop through them
Inside the Apply to each you would check with a condition if the
FileLeafReq eq 'yourfilewithextensionnamehereOrEnvironemntVariable'
in the yes side, run your script, in the no side do nothing
Now you can delete the file and not worry about your flow
Option 2
You can build a filter query directly into the Get files so that you do not have to use an Apply to each
Click Show Advanced
in the Filter query add the
FileLeafReq eq 'FilenamewithextensionOrEnvironmentVariable'
NOTE, my suggestion with Environment Variable would be to have you set the file name there and not hard code it in your flow but its not required if you just want to hardcode the file name.. I dont suggest it, but you can.
Either option will fix your issue.
If this resolves your issue please mark the answer a such thank you!!!