The group you're working with does not have order $p$. In discrete log schemes, you're not working in a finite field, $F_p$, but rather a multiplicative group $1,...,p-1$, which has order $p-1$. Since $p$ is a prime, $p-1$ is composite (as long as $p > 3$). Group theory tells us that there is a subgroup of size $d$ for every $d$ that divides $p-1$. By choosing a subgroup of order $q$, where $q$ is prime, we ensure that there are no (non-trivial) subgroups. This avoids small subgroup confinement attacks.
As mentioned in the other answer and comments, there are easy ways to find suitable $p$ and $q$. One is by using primes, $p$ and $q$, such that $p = 2q + 1$. Such a $p$ is called a safe prime. Another is by setting $p = qr + 1$, where $r$ has (potentially) unknown factorization. The group generated by this $q$ is called a Schnorr group.