Order of authors for a tenure-track assistant professor in the USA: second author after Ph.D. student or last author?
The answer for appropriate author order is very dependent on the culture of your (sub)field.  For example, if you are a computer engineer, you should probably be second author, while if you are a biological engineer, you should probably be last author.  Follow whatever you see others doing in the venues where you are submitting.

That said, these days it is often possible to make the contributions explicit so that there are no questions about contribution.  Many journals now request or require an "author contributions" section that attributes specific work to specific authors. Even if the venue that you are submitting to does not have such a requirement, you can still  add that information into the acknowledgements section.  Furthermore, the CRediT taxonomy provides a set of standard widely-recognized roles that are useful for describing such work.