Something very weird happened to me today and i'm wondering if anyone else has had anything similiar prior to birth?

I am 40+3 wks and had an appointment today for a S and S. Everything went ok, very uncomfortable as my cervix was pointing backwards but it was favourable etc. Anyway i had to go and have a ctg scan this arvo just to make sure all is fine with bubs.
About an hour before the appointment I went into a really weird phase of being very confused, abit dizzy and disorientated and couldn't remember simple things and string words together. It really freaked me out. Luckily i had dh here. Anyway i realised that it was 2pm and i hadn't eaten lunch so had a feed and started to feel a little better but anxious about what was happening. It's also worth mentioning that i haven't had hardly any sleep for weeks now and as a person who is prone to mild bouts of anxiety i know this is a trigger. Anyway i went to my appointment and the midwife said that it can be be a good sign ie normal to have bouts of vaugeness prior to labour and feel this way.

So has anyone else experienced this? I feel a little scared now that this loss of control is going to happen again, it wasn't nice. TIA