Most likely this was a maneuver because the Traffic Collision and Avoidance System told the pilots to do so. It's a ladies voice which tells the pilot to descend or to climb in order to avoid a collision. The other airplane is supposed to do the opposite.
This is a perfectly safe manouvre and, although it's rough on the passengers, shouldn't worry you at all.
By the way: Such a maneuver requires the pilot to fill out a report. But unless the two airplanes hit each other, the aviation authorities will only summarize such incidents.