I just found out that im 5 weeks preagnant, few weeks before I took Nexium (esomeprazole) for acid reflux and sertraline for panic attacks. Is that safe for the baby?

Likely OK. Nexium (esomeprazole) not a problem. The jury is not in yet on sertraline during pregnancy. The problems that have been suspected with sertraline appear to be more of a problem later in pregnancy, closer to delivery, with some of these meds being suspected to be involved in some cardiac/breathing problems in newborns at the time of birth with a condition called persistent pulmonary hypertension.