Since the emergence of the Coronavirus disease (COVID-19) pandemic, the disease has affected more than 675 million people worldwide, including more than 6.87 million deaths. To mitigate the effects of this pandemic, many countries established control measures to contain its spread. Their riposte was based on a combination of pharmaceutical (vaccination) and non-pharmaceutical (such as facemask wearing, social distancing, and quarantine) measures. In this way, cross-sectional research was conducted in Algeria from 23 December 2021 to 12 March 2022 to investigate the effectiveness of preventative interventions in lowering COVID-19 infection and severity. More specifically, we investigated the link between mask-wearing and infection on one side, and the relationship between vaccination and the risk of hospitalization on the other. For this purpose, we used binary logistic regression modeling that allows learning the role of mask-wearing and vaccination in a heterogeneous society with respect to compliance with barrier measures. This study determined that wearing a mask is equally important for people of all ages. Further, findings revealed that the risk of infection was 0.79 times lower among those who were using masks (odds ratio (OR) = 0.79; confidence interval (CI) 95% = 0.668–0.936;p-value = 0.006). At the same time, vaccination is a necessary preventive measure as the risk of hospitalization increases with age. Compared with those who did not get vaccinated, those who got vaccinated were 0.429 times less likely to end up in the hospital (OR = 0.429; CI95% = 0.273–0.676;p< 0.0001). The model performance demonstrates significant relationships between the dependent and independent variables, with the absence of over-dispersion in both studied models, such as the Akaike Information Criterion (AIC) scores. These findings emphasize the significance of preventative measures and immunization in the battle against the COVID-19 pandemic.