That's largely because there's the potential to abuse the drugs as well. Giving people painkillers is good, giving them at a strength that makes it easy for someone to overdose from one bottle, less good. For what it's worth, you can easily get 400 or 500mg ibuprofen over the counter in the UK, but it will probably involve interacting with a pharmacist who'll probably refuse to sell them to you if they suspect you're going to abuse them.
With antibiotics there's a pretty good reason for them to prescription only, namely that drug resistant strains of illnesses are becoming a serious problem and it's only made worse by the over use of antibiotics. Plus, you likely don't know what the appropriate antibiotics will be for what ever problem you're trying to treat are.