Earlier quoted context omitted.
If it were to happen "legally", instead of "civil war II: the farce", I suppose the obvious bit would be to pass a constitutional amendment[1] to allow Texas to secede, probably after a Texit referendum. Presumably similarly to Brexit all the nitty gritty minor details like "not destroying the economy" can be worked out in negotiation between Texas and the USA, which will no doubt leave the newly independent Texas in…
The article that allowed the UK to leave the EU was specifically crafted for the UK at the time they joined. The EU realized that mistake right away and removed it for future members. No such agreement exists in the Constitution because having states come and go as they please would be incredibly dumb.
https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX%3A...
"Any Member State may decide to withdraw from the Union in accordance with its own constitutional requirements."
Wikipedia (at https://en.wikipedia.org/wiki/Withdrawal_from_the_European_U...) notes that a formal method of leaving became a thing in the early 2000s when various Eastern European states were joining, not when the UK joined in the 1970s.
(As for the US, I did say actually passing a constitutional amendment to allow succession would be unlikely, but I don't think it's legally impossible?)