Q. If one has a problem cleaning himself after a bowel movement - no matter how much he cleans, he is still dirty, whether with excrement or excrement mixed with blood - may he daven and learn? If one discovers after davening that he was slightly dirty, does he need to repeat the davening?
A. Shulchan Aruch (O.H. 76: 5) rules that feces found on the anal area even when covered will prohibit one from reading shema or reciting any blessing and Torah learning (debarim shebekdusha): even if they could only be seen when one is sitting down and not when standing up. Mishna Berura (ibid. 16) explains that if someone suffers from haemorrhoids and constantly oozes blood accompanied by other malodorous discharges, he is forbidden to recite debarim shebekdusha, when a bad smell emanates from him. If there is no foul odour, it will depend on the source of the fluids.
There are indeed cases where an individual due to the severity of his condition may not be able to anymore pronounce anything of kedusha or don tefilin, as mentioned in Nishmas Avrohom ( 1: 76: 3) and his only remedy may be a surgical intervention.
However, many cases involve a number of doubtful situations, such as if the fecal matter could be seen or not, or if after cleaning himself he immediately discharges or not, what kind of discharge, if the odour can be masked by deodorizing agents, or the feces were already dry etc. therefore Poskim are lenient when one cleans himself and immediately after davens. (Piskey Teshuvos 76: 7) Eishel Avrohom writes that any doubt on this particular halacha you can rule leniently (ibid.)
Horav Shlomo Miller's Shlit”a opinion is similar in cases of great need. He recommends using using wet skin wipes.
When discovering a slight mark or stain after davening, if you can depend on any of the doubts mentioned above, you should not repeat brochos, but you may don tefilin again or recite a tefilas nedava or voluntary amida.
Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit”a