Suppose that we define, for any sets $x,y$, a set $(x,y)$ with the propertie that $$(x,y)=(x',y')\rightarrow x=x'\wedge y=y'(*)$$
Let $R$ be a set. I want to show that the classes $\{x:\exists y((x,y))\in R\}$ and $\{y:\exists x((x,y)\in R)\}$ exists.
My attempt:
Let $A:=\{z\in R: \exists v,w(z=(v,w))\}$ (this exists by separation axiom). Now take $\phi(z,u)\equiv\exists x,y(z=(x,y))\rightarrow u=x$.
It is easy to show that for each $z\in A$ exists an unique $u$ such that $\phi(z,u)$. So, by replacement axiom exists a set $B$ such that $\forall z\in A\exists u\in B\phi(z,u)$.
So, by separation axiom exists the set $\{x\in B:\exists z\in A\phi(z,x)\}=\{x:\exists y((x,y))\in R\}$ (In the same way we proof the existence of the another set).
My doubt is that I don't use $(*)$ or I don't see where I did. So, I don't know if my proof is right.
Edit: The only axioms that I can use are: extensionality, separation, pairing, union and replacement.
Definition. Let $x$ and $y$ be sets. The ordered pair $x$ comma $y$, denoted $(x,y)$, is $\rule{50pt}{0.4pt}$.
Here $\rule{50pt}{0.4pt}$ represents any definition used.
Remark. Let $x$, $y$, $u$, $v$ be sets. Then $(x,y)=(u,v)$ if and only if $x=u$ and $y=v$.
Here it is assumed that the above remark can be proven, and is the assumption $\color{blue}{(*)}$ you mention.
Proposition. Let $R$ be a set. Then $\{x:(\exists y)[(x,y)\in R]\}$ is a set.
Proof. Define the formula $\varphi$ with free variables $\check{p}$ and $\check{x}$ by $$\varphi(\check{p},\check{x}):=(\exists y)[(\check{x},y)=\check{p}].$$ By the axiom of replacement, $\{x:(\exists p\in A)[\varphi(p,x)]\}$ is a set. Indeed, $$\varphi:p\mapsto x$$ satisfies $(\forall a)[a\in A\:\Rightarrow\:(\exists!b)[\varphi(a,b)]]$ by $\color{blue}{(*)}$. That is to say $\varphi$ is a class function. Here $A=\{z\in R:(\exists a)(\exists b)[z=(a,b)]\}$.
$\square$
This proposition and proof can be modified to prove the range is a set as well.