As many others have said, it's a case of considering the fact that if Russia does invade Ukraine, will they stop there? Will they keep invading across Europe? How close to our country do we want them to invade to until we get involved? How many other countries will we stand by and watch Russia invade before we decide it's time to act?
You are correct OP that it is very, very expensive to assist in this way but it's been highly theorised that Russia is testing the water to see what they can get away with. Putin is an unpredictable force and he may not stop at Ukraine. Even if Putin does eventually manage to invade Ukraine but decides to stop there - will his eventual successor? Or will it be seen that Europe did so little that there would be the opportunity to invade other surrounding countries to increase Russia's grip.
However, I do also think that if other countries in Europe contributed more towards the Ukrainian efforts, we would then be in the position where we in the UK might not have to spend quite as much money on the support effort.
According to Algazeera's statistics (provided in December 2022), other than the USA and "EU Institutions", the UK is the highest provider of assistance, followed closely by Germany. Countries such as Poland, France, the Netherlands, Belgium, Switzerland, Estonia etc are contributing very little independently in the way of assistance, whether it be by financial, humanitarian or military means. Although almost every country is in a financial crisis of some kind or another currently, the UK is included in this and yet we are donating large amounts where other countries don't appear to be. Other countries need to step up to prevent Putin invading Ukraine and potentially moving further into Europe. I don't think we should withdraw support, but if other countries increased their levels of support it may be less necessary for us to spend as much - if we spent less but other countries gave similar amounts of assistance, Ukraine would have much more aid but the UK would be in a better financial position.
I do have a friend who is Ukrainian though so I may be biased in my absolute belief that we should contribute towards the Ukrainian defense effort. He is the same age as me (early 20s) and used to have a hobby doing WW1 and WW2 war reenactments as part of a group, taking photos and hosting displays for the public. It's gut wrenching to now see photos of him in full, modern military gear, carrying real, working weapons, forced to fight in a situation he never wanted to be part of. He is fighting to keep his home, his family, his sisters and his country safe.