Peace be upon you. The esteemed Ayatollah Sistani (may Allah protect him) states: The follower must follow the imam in actions and should not precede him in them; it is preferable to be slightly behind. If the follower delays significantly to the extent that it disrupts the following in a part of the prayer, the following becomes invalid for that part, and it is safer to consider it invalid altogether. This is unless the delay is due to an excuse; in that case, it does not affect the validity of the following. For example, if the follower reaches the imam before he bows but is prevented by crowding from joining him until he stands for the next unit, it is permissible for him to bow and prostrate alone and then join the imam afterward. Therefore, the follower should not delay to the extent that it can no longer be said that he is following the imam in actions, such as if the imam has bowed and raised his head from bowing and entered into prostration while the follower is still standing and has not bowed. Source: [Minhaj al-Salihin, Vol. 1, Rules of Congregational Prayer, M 815](
https://www.sistani.org/arabic/book/23720/4677/).
Additionally, the esteemed Ayatollah Khamenei (may Allah protect him) states: The follower must perform the actions of prayer in conjunction with the imam or shortly after him. If he deliberately precedes the imam or delays for a period, he becomes independent. Thus, the follower should not delay to the extent that it can no longer be said that he is following the imam in actions, similar to the previous example. Source: [Risalah on Prayer and Fasting, Prayer, Congregational Prayer, Duties of the Follower Regarding Following, M 733](
https://www.leader.ir/ar/book/196/1?sn=31805). May you be successful in all good.