Due to the importance of praying with the congregation, the Shulhan Aruch (O.H. 52:1) gives guidelines to follow if one arrives at the synagogue and sees that the congregation has already reached the end of Pesuke Dezimra, or further.
In the case where the congregation is nearing the end of Pesuke Dezimra, one who arrives late should recite Baruch She’amar, Ashre (Mizmor 145), Hellelu Et Hashem Min Hashamayim (Mizmor 148), Hallelu E-l Bekodsho (Mizmor 150) and finally Yishtabah. The Rama (ibid.) adds that if one sees that one has more time than originally thought, one should recite Hodu until the verse “Vehu Rahum”. One should then continue on with Birkot Keriat Shema and the Amida with the congregation.
If there is not enough time for the above procedure, one should skip Hallelu Et Hashem Min Hashamayim. The Rama says that if time is very limited one may simply recite Baruch She’amar, Ashre and the Yishtabah.
Finally, if one arrives and the congregation has already started the blessing of Yotzer, one should join them for Birkot Keriat Shema and the Amida, and then afterward, recite all of Pesuke Dezimra without a blessing.
The Mishna Berura (M.B, O.H. 52:1) states that an angel transmitted to Rabbi Yosef Karo that, based on the Zohar and according to Kabbalah, one should never skip portions of Pesuke Dezimra and that there is significance to saying everything in order. Thus according to this opinion, if one arrives late, one should recite Pesuke Dezimra in its entirety, even it means that one will miss praying with the congregation. The Hacham Tzvi (§ 36) clarifies and says that the Zohar’s intention is only for one who will not be able to catch up to the congregation. One who could catch up, however, should follow the Shulhan Aruch’s guidelines. The common custom is for one to follow the Shulhan Aruch and not the Kabbalisitic approach.
Rabbi Israel Algazi (Shalme Tzibbur) writes that if one is chronically late to the prayer, one is allowed to recite Pesuke Dezimra in its entirety since in such a case, one would otherwise never have the opportunity to recite it properly. As such, according to this opinion, the Shulhan Aruch’s ruling only applies to one who is late sporadically.
Summary: If one arrives to the synagogue and the congregation has already started Pesuke Dezimra, one should follow the guidelines outlined in the Shulhan Aruch.