Undoubtedly, excessive and constant doubt which makes a person obsessive is the temptation of Shaitan (Satan) who wants God's servants to become tired and lethargic towards worshipping God and finally despair of Allah's mercy. The best solution to these doubts is to pay no heed to them.
Also, if a person doubts three times in one prayers or doubts once in every three prayers consecutively, he is regarded as Kathir al-Shak (one who doubts too much), so he should not pay heed to his doubts.
Undoubtedly, excessive and constant doubt which makes a person obsessive is the temptation of Shaitan who wants God's servants to become tired and lethargic towards worshipping God and finally despair of Allah's mercy. Therefore, it is necessary on every believer to fight Shaitan and not to pay heed to his temptations so that he who is man's sworn enemy should despair and get ashamed.[1]
Kathir al-Shak is a person who doubts quite often. One such person should ignore his doubts, whether his doubt relates to the number of the Rak’ats of prayers or to parts of prayers or the conditions of prayers. If a person doubts three times in one prayers or doubts once in every three prayers consecutively (e.g. morning, Zuhr and Asr prayers), he is regarded as Kathir al-Shak. And if his doubts are not due to anger, fear or anxiety, he should not pay heed to them.[2] The criterion through which one can consider a person or himself as Kathir al-Shak is the Urf (common view).[3]
As for the second issue, it should be said that the sacred Shari'ah of Islam considers a thing to be impure only when one is certain that it is najis[4] but if he doubts whether it is pure or impure, that thing is treated as pure.[5]
Read answers 808 and 6820 in regard to this issue.
[1] - For further information in this regard, refer to relevant answers on our website:
Indexes "Cure for Obsession", No.1641.
"How to get rid of obsession" No.2158
"The Rule regarding an Obsessive Person" No, 2243
"Being Obsessive in Janabat" No. 2337
"Ways to get rid of Obsession" No.2731
"Obsession in the Acts of Religion" No.3894
"The Probability of Ejaculation and Obsession" No.7545
[2] - Tawzih al-Masail of Maraje', vol.1, pg. 643 – 644.
[3] - (Fazel:) The criterion through which one can consider a person or himself as Kathir al-Shak is the Urf. (Gulpaigani:) And if a person suffers a condition due to which he doubts three times in one prayer, he is regarded as Kathir al-Shak and he should not pay heed to his doubt. Tawzih al-Masail Maraje', Vol.1, pg. 463 – 464.
[4] - Tawzih al-Masail of Maraje', vol.1, pg. 85, issue 121.
[5] - Tawzih al-Masail of Maraje', vol.1, pg. 87, issue 123.