For a limited company in the UK, you need a number of pieces of legal paperwork which I think you can technically write yourself but may prefer a solicitor to draft them correctly for you, and then you pay £100 to register the company, and you (and any other directors, shareholders or guarantors) capitalise the company yourself.
You are now limited in liability for what the company does, to no more than the capital you put into it.
You then have to supply yearly accounts, may have to register for corporation tax, VAT, register as an employer for paying national insurance, you'll probably need business insurance, etc.
https://www.gov.uk/set-up-limited-company