Suppose a batsman hits the ball. The boundary fielder picks it up, but his leg touched the boundary rope.
The fielder throws the ball and one of the players is out of the crease when the wicket is broken.
Is the batsman run out or not ?
No. As soon as the fielder was simultaneously in contact with both the ball and the boundary rope, the boundary is scored and the ball is dead. See Law 23.1:
The ball becomes dead when [...] a boundary is scored. See Law 19.3 (Scoring a boundary).
The relevant part of Law 19.3 is
A boundary shall be scored and signalled by the bowler’s end umpire whenever [...] a fielder with some part of his person in contact with the ball, touches the boundary