Answer: the only solution is (p,q)=(13,31).
If p=q, then it must also hold that p2−p−1=2q+3=2p+3. This can be factored as (p−4)(p+1)=0. Since 4 and -1 are not prime numbers, this does not yield any solutions.
In the other case, we have p∣2q+3 and q∣p2−p−1. Since 2q+3 and p2−p−1 are positive, it follows that p≤2q+3 and q≤p2−p−1. To find a sharper lower bound for p, we multiply the two relations
pq∣(2q+3)(p2−p−1)∣2qp2−2qp−2q+3(p2−p−1)∣3(p2−p−1)−2q,
where we have discarded terms with a factor of pq. Note now that 3(p2−p−1)−2q≥ 3q−2q=q>0. This means that the above divisibility relation leads to
pq≤3(p2−p−1)−2q=3p2−3p−(2q+3)≤3p2−3p−p=3p2−4p.
If we move 4p to the other side and divide by p, we find that q+4≤3p, or
62q+3<3q+4≤p
Since p is a divisor of 2q+3, we deduce that 2q+3=kp with k∈{1,2,3,4,5}. If k=1, then we have 2q+3=p and thus also q=p2−p−1. But then it would hold that p=2q+3=2(p2−p−1)+3=2p2−2p+1. This can be factored as (2p−1)(p−1)=0, which has no solutions with p prime. If k=2 or k=4, then kp is even. But 2q+3 is odd, so these cases are ruled out. If k=3, then from 2q+3=3p it follows that q must be a multiple of 3. Since q is prime, we then have q=3, and thus also p=(2q+3)/3=3. Checking shows that this is not a solution to the original equation.
The last case is k=5. Then we have 5p=2q+3 and from the original equation, we have 5q=p2−p−1. If we substitute this, we get 25p=5(2q+3)= 2(p2−p−1)+15=2p2−2p+13. This can be factored as (p−13)(2p−1)=0. This gives the possible solution p=13 with q=(5p−3)/2=31. We check that (p,q)=(13,31) is indeed a solution to the problem.