Tbh the same logic can be applied to sleeping. If our consciousness is akin to computer ram and sleep is the brain cleaning up that ram, how can you know that when you wake up you're still the same person that went to sleep last night?
This is a cool thought because it's not about being copied but more about the Ship of Theseus.
Why do we sleep?
"The body needs sleep."
No, the body needs rest. Our physical self just needs down time and relaxation and then it's good to go again. Our BRAIN needs sleep. Specifically, REM sleep to process all the new data that was taken in. Converting short-term memories into long-term memories. Sorting and organizing data. A kind of hard drive defragmentation.
Our sleep is normally presented like a sine wave. We regain base level consciousness cyclically several times a night, which is why we dream. Which is why our dreams are usually tied to recent memories. The more good sleep we get, the more our brains can deal with recent experiences.
When we wake up, it's like rebooting a device after an OS update. It's us, but with altered software. We are as much the person we were yesterday as the Ship of Theseus is still the Ship of Theseus after having pieces fixed and replaced. The whole is who we are, not the bits that changed.
Because brain activity doesn't stop when I'm sleeping, it's more like the brain is just idling.
If we wanna go with computer terms, sleeping isn't shutdown. Sleeping is sitting on the desktop with no active windows. All the background processes don't stop when you're just sitting there and admiring your sick wallpaper.
how can you know that when you wake up you're still the same person that went to sleep last night?
Because you are composed of 99.99999% the exact same molecules. When you transport, you are literally ripped apart and recreated with new molecules at the destination site. That's how the transporter works. Your bed does not work that way.
This is why I don't like the word "consciousness" in these discussions. It has too many different but similar meanings. Our minds are, as far as we can tell, a property of the interactions between neurons in our brains. Sleep doesn't stop those interactions, even if we are "unconscious" during sleep.