Affects, no doubt. Sometimes stress improves memory, sometimes, on the contrary, it worsens. Think of yourself on the exam: I taught and taught all night, but took a ticket, and there was not a single thought in my head, and someone else and vice versa: the exam will pass 100 points, but then half-dead will sleep at home for two days.
If you are afraid that in a stressful situation you may forget or confuse something, try to "insure yourself" a little - learn breathing exercises to calm down. In a stressful situation, if possible and appropriate, you can try drinking a little water - usually this helps to recover a little, calm down, collect your thoughts and remember what you need right now.