To understand the answer, look at the medical community. After the initial 2-3 months of the pandemic, which consisted of a learning curve and period of preparation, hospitals and physician offices have largely been able to operate without the spread of COVID internally. However, this requires the proper masks, the proper use of masks, adequate hand washing and disinfecting, as well as other social distancing and PPE measures. However, these are not the conditions readily seen or replicable in the outside world. More recently with the spread of Omicron, the number of infections among healthcare workers increased dramatically. However, this may have been due to workers being infected on the outside rather than in the healthcare setting. Because of the increased level of infectivity of the new variants, it is possible that protective measures that were effective for early strains may not be as effective with newer strains. Best bet is to wear an N95 mask when in situations with the highest risk of exposure. These offer the most protection.
A simple study from early in the pandemic did conclude that mask mandates, do in fact, reduce the spread of COVID in the real world. On July 2, 2020, the governor of Kansas issued a mandate to wear facemasks in public places starting the following day. However, individual counties in the state were allowed to opt out of the mandate. This compared the 7 day average of new cases, from June 1, (4 weeks before mandate), until August 23, (7 weeks after mandate), in those counties that observed the mandate (2/3 of the population) and those that didn’t. The counties observing mandate had a 6% decrease in new cases and those that didn’t observe the mandate had a 100% increase in new cases.