Yes, you must at least double flank them. This escpecially helps against phalynxes because those holding the spears getting hit from the side at the edge of the unit must drop their spears, which helps your other unit in front of them to come in.
A nice little trick I learned was to take a small, tattered unit and engage them with the phalynx, then take a good unit and come in from the side. To this, the phalynx won't be able to adjust fast enough, thus, your good unit got into close quarters instead of at the tips of their spears.