There aren't many universal rules in UK businesses. Some offices have a lot of celebrations, cakes/sweets are brought in a lot (to mark different occasions), while others will let things pass almost unnoticed.
Bringing in food
If it's a place where people often bring in cakes/sweets, etc, you may want to bring something in for everyone. But equally there are offices where this doesn't happen (and with COVID some offices are less keen on communal eating). Different offices will have favourite foods, but cakes, buns, sweets, chocolate, national/regional delicacies, home-baking, etc, are all typical. People are unlikely to be very upset even if you break with tradition.
Presentations and speeches
Some businesses will have some sort of presentation on the last day, and maybe some kind of gift given to you (paid for by a collection from your colleagues). At such an event, there will probably be a brief speech from a manager, and you may be expected to say a few words in return - just thank everybody for the gift and for making your work easy and pleasurable (it's ok to single out people you've worked with closely) and maybe make a joke, it doesn't have to be much. This doesn't happen with every business - some companies like to mark events like birthdays, weddings, anniversaries of people starting work, etc, while others don't.
Departing
At the end of the day, if it's a small team, you can go round people saying goodbye. If you're seeing everyone later, you don't need to say goodbye. It's usual to send out a group email earlier in the day saying thanks and goodbye and providing brief contact details for anyone who wants to stay in touch (whether LinkedIn, social media, phone, email, or whatever you're happy to give, but you don't need to provide lots of methods of contact).
Leaving drinks
For leaving drinks, others have covered it. You may be lucky and get drinks bought for you, or people may pay for their own (either by buying individually, alternating rounds, or paying a bill at the end, depending on the establishment). I believe in parts of Europe it's usual to buy drinks for everyone on such occasions (or is that just birthdays?) but it's definitely not required in the UK. It's possible the company may pay something towards leaving drinks - this is rare, especially if you've not been there long, but it can happen.
Conclusion
There aren't a lot of rituals around leaving. In most workplaces, leaving is not a big thing, and shouldn't require any expense from you (beyond buying your own drinks/meal). Doubtless the office joker will come up with lots of other alleged traditions they insist you must do, but ignore them.