Marriage laws differ in the different UK countries. Also marriage laws have changed recently so people will need to know when your story's set. There have been quite significant changes in terms of who's allowed to conduct legal marriages, where they can be conducted etc. In the past it was just churches and the registry office - and also synagogues if I recall correctly. And captains of ships when at sea. But more recently they've legalised Islamic weddings and a few more religions, and certified some other buildings to allow weddings to take place there. Plus the fairly recent legalisation of gay marriage. And these various changes may or may not have occurred in all parts of the UK, and not occurred at the same time. Gay marriage in Northern Ireland was only legalised Jan 2020. I'm English and I honestly don't know which bits of marriage laws are the same outside of England or completely different most of the time.
One example of the law differing by country: currently in Scotland humanist marriages are legally recognised but in England they're not.
https://humanism.org.uk/ceremonies/non-religious-weddings/
I'm not a wedding celebrant. I'm just English. I could be wrong about the stuff below but I think it's important to consider what readers may find believable, even if you've got the technicalities correct, as this would affect how you explain things in story.
I've never heard of what you describe happening and I've read a lot of real life/personal experience stories, articles, documentaries etc over the years. Also, to discover only after 2-4 weeks and it being an issue that's easily fixed just doesn't sound plausible for how things are. If someone wants to get their own marriage annulled on the grounds that it didn't meet the legal requirements at the time, AFAIK there's a legal process for that which is usually done formally by one of the spouses, so the scenario where someone just turns up and says "by the way your marriage isn't legally recognised" just doesn't seem like something that could happen.
I quickly looked this up on Wikipedia and found this for the law in England and Wales:
England and Wales provides for both void and voidable marriages.[5]
Void marriage: spouses are closely related; one of the spouses was under 16; one of the spouses was already married or in a civil partnership
Voidable marriage: non-consummation; no proper consent to entering the marriage (forced marriage); the other spouse had a sexually transmitted disease at the time of marriage; the woman was pregnant by another man at the time of marriage
Section 13 of the Matrimonial Causes Act 1973 provides for certain restrictions in regard to the possibility of annulling voidable marriages, including where the petitioner knew of the "defect" and of the possibility of annulment, but induced the respondent to believe that s/he would not seek an annulment; or where it would be "unjust" to the respondent to grant the decree of nullity. There is usually a time limit of three years from the date of the marriage in order to institute the proceedings.[36]
NOTE: I don't know how up-to-date Wikipedia is.
ALSO NOTE: in England unless they changed it recently (they may well have done!), if you are aged 16-17 you need parental permission to marry. This was not the case in Scotland hence teenagers eloping to Scotland to get married has been a thing for decades. There's even a registry office just north of the border that's famous (infamous?) for this type of wedding. I'm not sure how that works in terms of automatically anulling a marriage, if a parent can annul the marriage of their 16-17 year old child if it took place in England.
ALSO: Closely related would have to be closer than 1st cousins because 1st cousin marriage is legal, AFAIK it's legal in the whole of the UK. So they'd have to be siblings, parent/child etc - very close, for the marriage to be declared void. I have heard of people finding out that they are siblings separated at birth who only found this out after being married, and their marriage subsequently declared void - but that's not an issue that's easily fixed!
Voidable means that the marriage wouldn't be automatically invalid but that you could apply to have the marriage annulled.
I think if there has been a paperwork error they would correct it but it wouldn't annul or void the marriage. They'd still be legally married but the registrar would have to correct the paperwork.
If they got married at a venue or with a celebrant that wasn't legally able to marry them in law, they wouldn't be able to sign the register or give them a marriage certificate. All parties would know in advance that the marriage isn't a legal one and that they'd have to go to the registry office to be legally married afterwards. This has been a thing for many years for Muslims and many other religions and evidently still is a thing for English humanists - and I suspect a number of minority religions such as pagans. Although I couldn't say for sure as I don't have the list.
If they thought they were getting a legal wedding and weren't they could find that out a couple of weeks later. But the celebrant would have to be extremely negligent and both spouses very naive for that to happen. It might even be considered fraud if someone's given the impression that they can conduct a legal wedding when they can't as presumably money would have changed hands in the process.