How can you tell the difference between a broken rib and a pulled rib muscle? What should I do for either one?

Difficult. Early on, the symptoms of rib fracture and pulled muscle may be very similar. With a broken rib, there should also be tenderness over the fracture site. Pulled muscles with resolve with time and simple treatment. If they symptoms do not decrease after several days, a cxr would be appropriate.
They may resemble. The pain may be very similar. Examination, and x-rays may clarify. Depends on any complications of trauma, lung injury.