When adding two points. calculating the lambda. x3 ≡ λ2 − 2x1 (mod p)

is that ( λ2 − 2x1 ) (mod p)

or is the mod applied only to the 2x1?

In general, the equation $$A \equiv B \pmod n$$ means that there exists some $k$ such that $$A = B + k n.$$ The $\cdots \pmod n$ part applies to the entire equation, not to one side or the other. It does not necessarily imply that $$A = B \bmod n,$$ where $B \bmod n$ is an expression in its own right usually meaning the smallest nonnegative remainder that can be obtained from dividing $B$ by $n$, although conversely $A = B \bmod n$ does imply that $A \equiv B \pmod n$.
Each elliptic curve can be represented by the form $y^2+a_1xy+a_3y=x^3+a_2x^2+a_4x+a_6$. Let $P$ and $Q$ be two points of this curve. In this case,
$$x_{P+Q}=(\lambda^2+a_1\lambda-a_2-x_P-x_Q)\pmod p.$$
Your question relates to a curve in the form $y^2=x^3+Ax+B$ and in a state where $P=Q$. So we have: $$x_{2P}=(\lambda^2-2x_P)\pmod p.$$