Consult your HR department and the brokerage that maintains the 401k for vesting rules. There is not a one-size-fits-all approach when dealing with vesting periods of your employers contributions.
Also, don't seek financial advice from helicopter pilots posting on JH. They are usually very ignorant about finance, like many other occupations' demographics. For basic financial management in the US, follow this flow chart and then read all the wiki information at r/personalfinance, and for retirement-related info read r/fire.