Don't worry, "How the United Kingdom works" is a political question and so subject to change.

For example, Wales was essentially just straight up conquered, and so for long periods Wales did not have any distinct legal identity from England. You'll see that today there's a bunch of laws which are for England and Wales but notably not Scotland, including criminal laws. In living memory Wales got some measure of independent control over its own affairs, via an elected "Assembly" but what powers are "devolved" to this assembly are in effect the gift of the Parliament, in Westminster, which is sovereign. Whether taking away those powers would go well is a good question.

On the other hand, Northern Ireland is what's left of English/ British dominion over the entire island of Ireland, most of which today is the Republic of Ireland, a sovereign entity with its own everything. It's only existed for about a century, and is a result of the agreed "partition" when the Irish rebelled because most of the Irish wanted independence but those in the North not so much. Feel free to read about euphemistically named "Troubles". In the modern era, Northern Ireland, like Wales, gets a devolved government in Stormont. Unlike Wales, the Northern Ireland government is a total mess, and e.g. they have abortion (like the rest of the UK, and like the rest of Ireland) only because Stormont was so broken that Westminster imposed abortion legalisation on them since they weren't actually governing. If you think the US Congress is dysfunctional, check out Stormont...

Finally Scotland was for a very long time an independent but closely related sovereign nation. It agreed to join this United Kingdom about three hundred years ago in the Acts of Union after about a century with the same Monarch ruling both countries. However, it too got a devolved government, a Parliament, probably the most powerful of the three, in Holyrood, Edingburgh in the 20th century and it has a relatively powerful pro-independence politics, the Scottish National Party is the dominant power in Scottish politics, although how many of its voters actually support independence per se is tricky to judge.

Brexit changed all this again, because as part of the EU a bunch of the powers you could reasonably localise, and so were "devolved" to Wales, Scotland and Northern Ireland, had been controlled by EU law. So Westminster could say they were devolved, knowing that the constituent entities couldn't actually do much with this supposed power. Having left the EU, those powers were among the thing Brexiteers seemed to have imagined now lay at Westminster, but of course the devolved countries said no, these are our powers, we get to decide e.g. how agricultural subsidies are distributed to suit our farmers.

That's even more fun in Northern Ireland, because they share a border with the Republic, an EU member, and so they're not allowed to have certain rules that would obviously result in a physical border with guards and so on. Their Unionists (the people who are why it isn't just part of the Republic of Ireland because they want to be in the United Kingdom) feel like they were sold out by Westminster politicians, while the Republicans (those who'd rather be part of the Republic) see this as potentially a further argument in favour of that. All of which isn't helping at all to keep the peace between these rivals, that peace being the whole reason we don't want to put up a border...