Question: If one uses the restroom while in the middle of reciting Pesukei De’Zimra (the segment of the Shacharit prayer between “Baruch She’amar” and “Yishtabach”), when should one recite the “Asher Yatzar” blessing?
Answer: If one feels that he must use the restroom while reciting Pesukei De’Zimra should not continue praying; rather, one should stop praying and use the facilities. After one has concluded, one should wash his hands (as we have already discussed in the laws of the “Asher Yatzar” blessing) before resuming one’s prayer.
We must now discuss when one should recite the “Asher Yatzar” blessing. If one waits until one has concluded the Pesukei De’Zimra, one may forget to recite the blessing at that point. Additionally, it is not proper to postpone reciting the “Asher Yatzar” blessing needlessly. On the other hand, however, one may not interrupt in the middle of Pesukei De’Zimra by reciting unrelated things; it seems that the “Asher Yatzar” is not related to the Pesukei De’Zimra and it therefore seems that one should postpone reciting this blessing until after the prayer or, at the very least, until one has concluded the “Yishtabach” blessing, before beginning the “Yotzer Ohr” blessing. Indeed, the Chayei Adam rules that it seems that the “Asher Yatzar” blessing should be postponed until after “Yishtabach”.
Nevertheless, Hagaon Harav Yeshua Shababo quoted in Responsa Ginat Veradim writes that since one has, in any case, interrupted his prayer by going to use the restroom, one may still recite the “Yishtabach” blessing. He writes that one may also recite the “Asher Yatzar” blessing in the middle of the Pesukei De’Zimra before “Yishtabach” although the “Yishtabach” blessing was instituted to be recited immediately following the Pesukei De’Zimra. The author of Ginat Veradim agrees to this ruling as well.
Halachically speaking, Hagaon Harav David Yosef Shlit”a writes in his Halacha Berura that since there is room to claim that the “Asher Yatzar” blessing is somewhat related to the Pesukei De’Zimra, for it is also a form of praise and thanksgiving to Hashem in addition to the fact that according to the reason set forth by Rabbeinu Yeshua Shababo that one’s prayer has, in any case, been interrupted, the correct ruling on this matter is that one should recite the “Asher Yatzar” blessing immediately after washing his hands, even if one is in the middle of Pesukei De’Zimra. However, if one has already concluded the Pesukei De’Zimra and all that remains is to recite the “Yishtabach” blessing, it is preferable to postpone reciting the “Asher Yatzar” blessing until after “Yishtabach”. Similarly, if one is in the middle of a given psalm or prayer within Pesukei De’Zimra, one should conclude that paragraph and only then recite the “Asher Yatzar” blessing.
Summary: If one uses the restroom in the middle of Pesukei De’Zimra, one should conclude the paragraph one was in the middle of reciting and then recite the “Asher Yatzar” blessing. If one has already concluded the entire Pesukei De’Zimra and has just not recited “Yishtabach” yet, one should first recite the “Yishtabach” blessing and only then recite the “Asher Yatzar” blessing.