If subjective identity is just an illusion that works, I don’t see why we have a problem. Firstly, of course, let’s assume for the sake of simplicity that there is no such thing as an immortal soul that goes somewhere after you’re dead. In the Star Trek universe, this has most likely been proven beyond doubt, and people don’t have a problem with it.
Imagine the following: Transporter technology has in fact recently been invented, last week, in a top-secret government program. However, before unleashing the technology on the public and driving airlines out of business, the government agency in question has decided to do some… tests.
The following may come as a shock to you, but stay with me: Last night, after you had fallen asleep, a team of agents came to your house and sneaked into your bedroom. They released a sedative gas into the room to prevent to from waking up. Then, they scanned a perfect copy of your dormant self onto a computer chip. Next step - they vaporized you, or dragged your body outside and shot you in the head - it makes no difference, as you weren’t aware of any of this. Bye, bye - you’re dead.
Next, they created a perfect copy of you, sedated and everything, from the information on the chip, and put that in your bed. This morning, you woke up and went to work, as usual, with no recollection or knowledge that you had in fact been killed and replaced with a clone during the course of the night - all you have today is a slight and somewhat puzzling hangover (hey, the technology isn’t perfect yet). Well, you take an aspirin, go about your business, and never suspect a thing. The new you has all the memories of the old you. As far as you are concerned, identity has been preserved. Yesterday’s you had no experience of croaking*****, and you (that is, today’s you) have no idea that you just came into existence last night. As far as you’re concerned, everything is just dandy. I mean, barring the fact that it’s obviously completely unlikely, is there even any way for you to be sure that this scenario didn’t happen to you last night? Does it make any difference to your sense of self if it really did happen or not?
(***** I’m putting this part in just to be nice. Obviously, it doesn’t really make any difference to the scenario if they had instead, just for kicks, woken you up and dragged you kicking and screaming out into the street, before proceeding to club you to death with baseball bats, as long as they scanned you onto the chip first).