I’m no lawyer and don’t know the exact legislation, but I believe in the UK you are allowed to use sufficient force in self-defence. That could include lethal force, if necessary. (Obviously, it’s down to the authorities and jury in the luxury of their own time to decide what constitutes sufficient force.) I understand you can only do this for personal defence, not for defence of any property. I.E. If you attack someone simply for the fact that they broke into your house or your car, when there was no immediate risk to anyone’s safety, then you can and almost certainly will be prosecuted for that.
There was a famous case a decade or so ago in which a farmer, Tony Martin, opened fire with a shotgun and killed a member of a gang that had broken into his home at night. I think the person who was killed was aged 16 and the other gang members were all over 18. If I remember correctly, the farmer lived alone in quite an isolated farmhouse that had suffered several break ins. He had set up a kind of barricade at the top of his stairs in anticipation of another break in, and from which he fired upon the intruders. It was the fact that he was prepared in this way, almost ready and waiting for them, that seemed to lead to his being prosecuted. I think he went to prison for about 6 or 7 years.
I’m sure that if he’d been more surprised by the break in and swung a lamp stand at the intruders, or if he had a family to protect, he’d have been looked at more favourably by the authorities and jury, even if he’d killed one of the intruders. In my opinion it’s wrong that you should be looked at less favourably if you are pre-prepared, as he was. I also think that if your home is broken into in the middle of the night, and you are outnumbered, you should be excused almost any kind of reaction, because physically and psychologically you are in a very vulnerable position. You can't exactly ask the intruders whether or not they intend to do you any harm before making a considered decision whether or not to use force against them. Yet that seemed to be what many expected him to do. I never really understood the prosecution in that case, although I stand to be corrected if I’ve got any of the facts wrong.