I did my namaz zohr, and I doubt if I did 3 or 4 rakat. I just finished my namaz and considered that it's my 4 rakat.

Normally, if I doubt like this, I always perfom 1 rakat of Namaz e ihtiyat. But as I doubt frequently, everyone told me to ignore my doubt.

Then, I finished my salat, I did tasbih and duas . But My mind was not clear. So I still perfomed namaz e ihtiyat before performing asr.

So, my question is, my namaz still valid?
Is it ok if I did namaz e ihtiyat after but not directly after the salam of my namaz?
Because I did others ibadat before namaz e ihtiyat.

If you have a doubt frequently , ignore it. If you want to read namaz ihteyat read it straightaway after Salam.