On top of this, does the UK maybe work differently than Canada when it comes to marriage laws?

In Canada, marriage is done at the provincial level, hence regardless of immigration status (visitor, work permit, illegal, whatever), you can still get married without issue. Is the UK different in that respect, and marriage is done at the federal level, or?