Unhealthy Diet Recovery

I’m trying to transition myself out of a diet where my calories, fat and carbs were all far too low (dangerously low) and my working out was far too much. I’d been in deep for about five months or so. I’m scared of gaining the weight back, but more scared of what could become of my health if I don’t start getting the proper nutrition and rest. I just want to be healthy!

Has anyone ever put themselves in a similar situation and come out okay?