Let $\underline{A}$ be a unary algebra with $B$ as a subuniverse and define $\theta$ as $a\theta b$ iff $a = b$ or $\{a,b\} \subseteq B$
Equivalence Relation:
Reflexive : let $a \in B$ $a=a$ so $a \theta a$
Symmetry: let $a,b \in B$ and assume $a\theta b$ then $a=b $ or ${a,b} \subseteq B$ so we have $b=a$ or $\{b,a\} \subseteq B$ thus $b\theta a$
Transitive: let $a,b,c \in B$ and $a\theta b$ and $b \theta c$ then $a = b = c \implies a=c$ or $\{a,b\},\{b,c\}\subseteq B \implies \{a,c\} \subseteq \{a,b,c\} \subseteq B \implies \{a,c\} \subseteq B $ thus $a\theta c$
We get that $\theta $ is an equivalence relation.
Now, $B$ is assumed to be a subuniverse of $\underline{A}$ hence for all operations in $\underline{A}$ we know $B$ is closed under them.
Consider, $a,b \in B$ such that $a \theta b$ and let $f$ be a unary function in $\underline{A}$:
Case 1: $a=b$ then $f(a) = f(b)$ thus $f(a) \theta f(b)$
Case 2: $\{a,b\} \subseteq B$ as $B$ is closed under all fundamental operations in the algebra thus we know $f(a), f(b) \in B$ thus $\{f(a),f(b)\} \subseteq B$
Therefore, $\theta$ is a congruence on $\underline{A}$
This seems pretty straightforward but I want to make sure I am doing this correctly.