I apologize if I caused any confusion. In my current situation, my employer offers both a 457 and a 401. They allow me to apply the employer match (3,500 a year) into either my 457 or 401k. Each plan has slightly different rules:
- the max contribution into the 457 is capped at 18,000/yr (this is for both employee and employer contributions)
- for the 401k, employee contribution is up to 18,000/yr and you can also get "extra" contributions from your employer up to a total of 53,000.
- also, as you stated, you can withdraw from the 457 penalty-free prior to 59.5
Given the above rules, in my situation I max the 457 first (since it'll benefit me greatly during FIRE due to the lack of the 10% early withdrawal penalty). Then, I also contribute enough to the 401k to get the full employer match. It just so happens that I'm maxing that too so I'm getting a full contribution of 21,500 (18000 + 3500) into my 401k/yr.
Ideally, you want to max the 457 and then contribute enough to your 401k to get your employer's full match. I would also prioritize HSA contributions prior to IRA/Roth IRA contributions, but that's a bit more of a toss-up based on your personal health-related priorities.