I have been told that any straight line in $\mathbb{R}^2$ can be represented by two parameters $(p,\theta)$ and the equation:
$$x\cos(\theta)+y\sin(\theta)-p=0$$
But am struggling to see intuitively why this equation gives a straight line. Can anyone explain to me in terms of geometry what the parameters $p$ and $\theta$ represent in terms of the line (i.e. like when we represent a line as $y=mx+c$, $m$ is the gradient and $c$ is the intercept, what is $\theta$ and $p$ in this setting?)?

This is sometimes called a "normal" equation. Here, $(\cos\theta,\sin\theta)$ is a normal vector to the line, and therefore $\theta$ is the angle between the normal and the $OX$-axis. $p$ is the distance from the line to the origin.