You should get travel insurance before you travel. If you’re coming to the UK on a visa, it’s advisable to obtain insurance before your journey.
If you’re based and travelling from the UK around Europe and other destinations, it’s more advisable to purchase travel insurance in the country your travelling from.