2001 Ford Crown Vic

After I start my car, when I put my foot on the brake to put it into gear, the car dies. Sometimes it will start back up sometimes it won’t.