Although there is no 100% correct answer on how to use one’s money, people often follow similar flows in allocating money in investments, HSAs, retirement funds, etc.
The Fire Flow Chart is a very popular flow of allocating money for maximum returns.

Fire Flow Chart v4.2
Summary of flow in order:
- Budget and Essentials
- Rent/mortgage
- Food/groceries
- Essential items
- Income earning expenses
- Health care
- Minimum payments on debs/loans
- Employer Match and Emergency Fund
- Emergency fund
- Contributing to maximize employer match
- Debt Reduction
- Pay off highest interest rate loans
- Health Savings Account
- Contribute to HSA if eligible
- Individual Retirement Account
- Traditional and Roth IRAs
- Backdoor Roth
- ESPPs, Additional Savings, and maximizing your tax advantaged accounts
- ESPP
- Funds for large purchases or personal investments
- After Tax 401ks, Education Accounts, Taxable Accounts, and Low Interest Loans
- Mega backdoor Roth IRA
- Tax harvesting
- Pay off low interest rate loans
References
Fire Flow Chart Version 4.2:
https://www.reddit.com/r/financialindependence/comments/ecn2hk/fire_flow_chart_version_42/