If an antibiotic is used, all of the bacteria are killed apart from the bacterium that's resistant to antibiotics, allowing the resistant strain to survive and reproduce without any competition from other bacteria.
Patients should make certain to complete that course of antibiotics to ensure that all of the bacteria are killed and none can survive to mutate and form resistant strains.
Researchers are currently developing new antibiotics, but the problem is that this takes a long time and it's extremely expensive, and as new antibiotic resistant bacteria emerge all the time, it's unlikely that we'll be able to keep up.