Answer: The Gemara (Sukka 25a) teaches that one who is involved in one mitzva is exempt from participating in another. Thus, one who is visiting a sick person would be exempt from eating in a sukka. The Ran (Sukkah 25a) and Rema (OC 38:8) write that even if one can continue performing the first mitzva, one is exempt from performing the second mitzva if the first one will be affected as a result.
The Shulchan Aruch (OC 92:10) writes that it is commendable to give tzedaka before davening. The Mishna Berura (92:36) notes that in some shuls people collect for tzedaka during kerias Hatorah. This is wrong as it prevents people from following along and answering barechu.
The Shulchan Aruch (OC 96:1) writes that one mustn’t hold money while davening the amida. The Pri Megadim (Eshel Avraham 132:1 Mishbetzos Zahav 96:1; 566:3 quoted by Mishna Berura 96:1) extends this to when reciting the shema, pesukei dezimra or chazaras hashatz, too. Nonetheless, R’ Shlomo Zalman Auerbach (Halichos Shlomo, Tefilla 7:4) disagrees, writing that there is no prohibition in handling money during pesukei dezimra. Indeed, the Mishna Berura (92:36) writes that some have the minhag to specifically give tzedaka during vayevorech Dovid. R’ Shlomo Zalman Auerbach would prepare money beforehand so that people could collect money.
Following this, R’ Moshe Sternbuch (Teshuvos Vehanhagos 3:287) writes that while one is davening they are exempt from giving tzedaka. Especially as those collecting usually specify what they are collecting for, it can be quite distracting. It is wrong to collect money then.
Seemingly, this would explain why many shuls allow one to collect with a tzedaka box where no explanation is required and distraction is kept to a minimum.
In conclusion, one should give tzedaka before or after davening rather than during davening.