It seem like there's some confusion about how perspective projection works in the first place, so I will try to clarify this point.
Let $p_w = (p_{w,1}, p_{w,2}, p_{w,3})$ be the world-space coordinates of some point $p$. By world space I mean that the coordinates are defined with respect to the standard coordinate system in $\mathbb{R}^3$ with origin $O=(0,0,0)$ and basis $e_1=(1,0,0), e_2=(0,1,0), e_3=(0,0,1)$. Introduce a notion of camera which for the current purpose would be defined through an origin $c_w = (c_{w,1}, c_{w,2}, c_{w,3})$ and orthonormal basis vectors: $t_w = (t_{w,1}, t_{w,2}, t_{w,3})$, $n_w = (n_{w,1}, n_{w,2}, n_{w,3})$, $b_w = (b_{w,1}, b_{w,2}, b_{w,3})$. Then the point $p_w$ can be expressed also through its coordinates $p_v$ in the camera's coordinate system: $p_w = c_w + p_{v,1}t_w + p_{v,2}n_w + p_{v,3}b_w$, or equivalently in matrix notation:
$$p_w = c_w+M p_v, \, M = \begin{pmatrix} t_{w,1} & n_{w,1} & b_{w,1} \\ t_{w,2} & n_{w,2} & b_{w,2} \\ t_{w,3} & n_{w,3} & b_{w,3} \end{pmatrix}.$$
To find $p_v$ we compute $p_v = M^{-1}(p_w-c_w) = M^T(p_w-c_w)$. Now assume that we want the camera's projection plane to be at $z_{v}=1$ in the camera's coordinate system (i.e. it's perpendicular to the $b$ vector and it's at an offset of $1$ from $c$ along it). We can find the perspective projection $p_{\pi}$ onto that plane using: $p_{\pi} = \left(\frac{p_{v,1}}{p_{v,3}}, \frac{p_{v,2}}{p_{v,3}}\right)$. As you can see the projected point is two-dimensional, its 3-dimensional analogue (as a 3D point on the film) in the camera's coordinate system is $\left(\frac{p_{v,1}}{p_{v,3}}, \frac{p_{v,2}}{p_{v,3}}, 1\right)$.
In computer graphics, we typically need some depth information while drawing fragments/pixels to figure out which surfaces are occluded and which aren't (see Z-buffer). For that purpose it is useful to also keep information about the "depth" of $p_v$ before it gets projected, then the third coordinate is kept in the form $a + \frac{b}{p_{v,3}}$ where $a$ and $b$ are constants determined by the near and far plane values. Thus in ndc coordinates you typically have the triple $\left(\frac{p_{v,1}}{p_{v,3}}, \frac{p_{v,2}}{p_{v,3}}, a + \frac{b}{p_{v,3}}\right)$ (sometimes a division by the negative of $p_{v,3}$ is employed). Using the third coordinate one can figure out whether a specific point $p$ is "behind" another point $q$: $p_{v,3} > q_{v,3}$.
Often people want to control the size of their imaginary camera film, and the near and far plane values. To achieve this typically a projection matrix is applied to $p_v$ before the division (yielding $p$ in clip space). Note that even though it's termed a projection matrix, it doesn't really project anything, as the projection occurs through the division.
An orthographic projection on the other hand is achieved by just dropping the last coordinate of $p_v$: $(p_{v,1}, p_{v,2})$.
Regarding implementation details in various APIs and some more information I would suggest reading:
http://www.songho.ca/opengl/gl_projectionmatrix.html
http://www.songho.ca/opengl/gl_transform.html
https://learnopengl.com/Getting-started/Coordinate-Systems
https://learnopengl.com/Getting-started/Transformations
I should probably also touch upon how this is related to vanishing points. First to disambiguate from the pinhole/perspective projection point of the camera $c$: all points lying on the same line passing through $c_w$ (the origin/pinhole of the camera) and $p_{w}$ get projected to the same point $p_{\pi}$. Note that $c_w$ is not a vanishing point. Now consider parallel lines in 3D space. A line can be defined parametrically as $l(\alpha) = f + \alpha d, \alpha \in \mathbb{R}$, where $f$ is some point on the line and $d$ is its direction. Two lines $l(\alpha) = f+\alpha d,\, k(\beta) = g+\beta h$ are parallel if $d \parallel h$ ($\exists \gamma\ne 0: d=\gamma h$). Now given two arbitrary parallel lines in the coordinate system of the camera: $l_{v}(\alpha) = f_v + \alpha d_v, \, k(\beta) = g_v + \beta h_v$ their projections intersect on the projective plane at $\left( \frac{d_{v,1}}{d_{v,3}}, \frac{d_{v,1}}{d_{v,3}} \right) = \left( \frac{h_{v,1}}{h_{v,3}}, \frac{h_{v,1}}{h_{v,3}} \right)$ which one terms the vanishing point for all lines parallel to those. Artists sometimes draw those points to check the correctness of their perspective/construction :

The vanishing point doesn't exist only on the projection plane, but it also exists if we extend $\mathbb{R}^3$ with the points at infinity through homogeneous coordinates:
$$(d_{v,1}, d_{v,2}, d_{v,3}, 0) = (\gamma h_{v,1}, \gamma h_{v,2}, \gamma h_{v,3}, 0) = (h_{v,1}, h_{v,2}, h_{v,3}, 0).$$
You can think of this point as one situated on a sphere at infinity - each unique direction gets its own point at infinity ($d$ and $h$ represent the same direction thus they get the same point at infinity). If you project this point onto the projection plane you get precisely the intersection point $\left( \frac{d_{v,1}}{d_{v,3}}, \frac{d_{v,1}}{d_{v,3}} \right) $ of the projection onto the projection plane of any lines parallel to $d$. There is a caveat for lines parallel to the projection plane (e.g. of the form $(d_{v,1}, d_{v,2}, 0)$): the intersection of their projections lies in $\mathbb{R}^2$ extended with homogeneous coordinates, namely: $(d_{v,1}, d_{v,2}, 0)$ (this means that their projections remain parallel in practice, and those are the only lines for which this holds).