It comes down to budget, and time.
Rubber guns are preferred because they'll come in under $10 to produce (molding, casting, & painting). Often, pop-houses stockpile rubber guns. They are always the best option based on production costs alone, especially in a movie with a lot of gun-carrying extras, and cast (cop, action, and war movies). You don't have to babysit them, you don't have to secure them, and they lower your insurance rate.
Real guns and modified guns come in second because they can be rented, and the expense is still cheaper than CGI (for now), and cuts down post-production time. Real guns have been used safely on movie sets for just over a century, something that cannot be said of automobiles, motorcycles, or helicopters, which no one is demanding the end of their use in movies.
We just coming up on the 40th anniversary of the Texas Chainsaw Massacre where the same principles were in play. Real chainsaws were used along with modified, and dummy chainsaws to create realistic on-screen action. No one was hurt because safety came first, and the movie's budget was under $140,000.