I'm assuming from the terminology this is North American undergraduate program and you intend to apply for a North American Ph.D. in engineering as well, or in an adjacent field.
Screwed? Probably not. Have some explaining to do? Probably.
There's an initial review of your file, and then -- potentially -- an admission committee discussion. (My perspective is from North American math, applied science, and business; not quite engineering but the variation between institutions here is at least as big as between fields, so details vary.)
In the initial review, I doubt anyone will recalculate your GPA from your grades; they will take your institution's reported value. However, how good a 3.7 will be perceived depends on how prestigious your undergraduate institution is and how soft/hard its grading is known to be. A 3.7 from a challenging institution, where it took unusual grit and ability to redo your courses and score so well is one thing. A 3.7 where everyone redoes courses and most people therefore end up with GPAs of 3.25+ may be quite weak.
This will also be coupled with your scores on standardized tests (e.g. GRE), if applicable. This review may get you rejected, or may rank you as a potential admit to go to the committee for discussion.
If you do get to the committee, if they are doing their job well, unusual patterns in your transcripts will get noticed and highlighted. However, if you rank highly on other criteria, it is unlikely they will be truly negative. The committee is looking for evidence you will be successful in a Ph.D. program and in research; undesirable patterns in grades are a minus, but positive evidence from letters of recommendation, achievement in research-related activities, and a compelling personal statement in your application can all compensate.
With that in mind:
To the extent you are still able, overinvest in "research-relevant" activities, such as assistantships, seniors-thesis courses, etc. (That horse may have left the stable)
Prime the professors writing your letters of recommendation to emphasize your research-readiness, and, if possible, to comment on your positive trajectory and uniqueness.
Address in your personal statement, not as a detailed apology, but make sure to explain your story and how you have evolved as a student, and what type of personal growth occurred during your studies. Basically, prime the committee to be able to say the right predictor of success is the articulate, successful, self-aware you submitting the application, not the confused freshman you or even the average of the two.