Hadith.2878 - Imam عليه السلام said regarding a man who gave money to another to perform Hajj on his behalf, but the person performed Hajj for himself instead:
"It is on behalf of the one who provided the money."
There is no harm if a woman performs Hajj on behalf of a woman, a woman on behalf of a man, a man on behalf of a woman, or a man on behalf of a man.
Similarly, there is no harm if a person who has not performed Hajj (ṣarūra) performs Hajj on behalf of another ṣarūra, a ṣarūra on behalf of someone who has performed Hajj, or someone who has performed Hajj on behalf of a ṣarūra.