Don’t play chaotic evil characters like that
It seems somewhat obvious so I was hesitant even typing this answer, but this isn’t the first time I’ve seen questions of this sort crop up so I might as well.
Chaotic evil characters are unpredictably violent, and sooner or later they are going to turn on other party members with murderous intent.
Well, no. Don’t do that. Certainly such a character is chaotic evil according to most descriptions, but chaotic evil does not necessarily imply “unpredictable mass murderer with 0zero social functioning”, the same way “lawful good” does not necessarily imply that the person is completely incapable of tolerating infractions to the “the law” or will never do anything that anyone might consider evil.
A chaotic evil character doesn’t even necessarily have to be a murderer at all. It’s entirely possible, and in fact likely that such a character would draw the line somewhere. Even if a character is a murderer, that doesn’t mean they’re indiscriminate. Normally people do something with some goal in mind. A chaotic evil murderer doesn’t necessarily enjoy killing, they might just see it as a viable way to get what they want - whatever that might be. In line with that, a chaotic evil character may well like the other party members. They might be the only people they’ve ever met who’ll put up with their antics, and they may well appreciate that.
Put some restraint on the character, some sort of consistent characterisation that makes them function in a party – not really that different from playing characters from other alignments in that regard – and it’ll work out much better.
TL;DR
The problems you’re describing come from playing an evil character like they’re an unhinged indiscriminate murder hobo. Not everyone who can accurately be described as “evil” is an unhinged indiscriminate murder hobo, even on the chaotic end.