I would recommend doing all you can NOT to take any out at all. Needing and desiring 25-30k are very different. I would really look hard at that first.
You are taking a hit with the penalty and taxes and will have to repay this loan with after-tax money when, hopefully, you are investing with pre-tax money.
If you have your money in an S&P type fund you have made around 20% for the year. If you take this money away you are essentially taking out a 20% loan.
Some 401Ks have rules on whether you can still contribute while repaying a loan; some have rules that halt a company match while there is a loan against it.
Verify and think about all of these things before taking out a loan.
I always tell folks NOT to take out a loan UNLESS there is absolutely nothing else that can be done.
If you have that much in your 401k and your bills are caught up and your credit is decent, you should be able to get a loan somewhere else, somehow.
Assuming you are maxing out on your 401k -- which you should be doing at your age -- this is a big, big hit to your longterm retirement savings.
There are various calculators online that will show you how much money you are potentially losing in the long run.
Depending on the job situation, there can be issues with what happens should you lose your job while repaying.
This can also cause bad financial decisions later. A lot of folks that start taking loans continue to do so throughout their career, etc.
These folks are also rarely the types, or are not in the situation, to be able to pay the loan off early. Sometimes the plans will not let you pay it off in larger amounts than the agreed amount -- unless you pay it off all at once.
There are even cases to be made, when looking at all of these factors, to just withdraw it and pay the penalty and the taxes and NOT do a loan. This is especially true if there are issues with the plan on how soon you can get back to full contribution and company match.
I would NOT take it out UNLESS totally needed and there are NO other alternatives.
IF you DO take it out I would just withdraw it and take the hit. This would get you back to investing quicker and easier because you will NOT have to be repaying money.
BUT do NOT let it be the start of a trend.
You have more than the average person at your age saved, so you seem to not have many issues with finances. Congratulations on that!
I would take a withdrawal IF YOU HAVE to have the money and cannot find another way to get a loan AND if it is not the start of a bad trend.
Good luck with whatever you decide to do.