Interest rate on the debt, and are you going to rack it up again once it is moved to the house / paid for by 401K loan?
401K loans are high risk - if you separate from the employer before it is paid back, you have to pay the remaining balance in full or face a tax bill and penalties. And it unplugs your investments - not so much a real loan as selling the assets, taking the cash, then committing to return the amount + interest to the account with a pretty substantial penalty if you don't. So I'd avoid doing that if possible, but if interest is very high and it is something you can pay back quickly, maybe not a 100% DON'T DO IT thing.
HELOC of course further encumbers your house, so there is risk there as well, but I'm personally more comfortable with this approach if it will save you interest. A lot of HELOCs are variable-rate, so be very aware of the terms of the loan.
All that being said, unless you are 100% sure you're not going to find yourself in a year with a 30K HELOC or 401K loan and another 30K in CC debt, don't do it. Getting control of the spending that leads to debt is much more important in the long run than minimizing the interest paid.