1. Remove porn from your life. Use opendns to block websites and try to practice abstinence. It will take months/years but doable. Check Universal Man yt channel: https://m.youtube.com/channel/UC6gyVlwXwtqkn4KLjx3nDHg
2. Envy and other mind traps can be cured with having the right mindset. Look into stoicism
3. It's all about building habits and routine. You are your habits
Although controversial, Jordan Peterson's advice helped me when I was in a similar stage as you.
Look to form relationships and focus on something meaningful, the bad habits will disappear as you won't have time for them. Good luck