If it is a naafil prayer, then the matter is broad in scope and there is no reason why you should not interrupt the prayer and find out who is at the door. But if it is an obligatory prayer, you should not rush unless there is something important that you fear you may miss. If it is possible to alert the person at the door to the fact that the person inside the house is busy praying, by saying tasbeeh for a man or clapping for a woman, then that is sufficient, as the Prophet SAWS (peace and blessings of Allaah be upon him) said: “Clapping is for women and the one who notices something whilst praying, let him say Subhaan Allaah.”
If it is possible to tell the person at the door that the man is praying by saying tasbeeh or that the woman is praying by clapping, that should be done. If that will not serve any purpose because one is far from the door and will not be heard, then there is nothing wrong with interrupting the prayer in the case of need, especially naafil prayers. In the case of the obligatory prayer, if there is the fear that the person is at the door for some important reason, then there is also nothing wrong with interrupting the prayer, then one can go and start the prayer from the beginning. Praise be to Allaah. End quote.
Fataawa ‘Ulama’ al-Balad al-Haraam (154).