Lyapunov equation is used for the stability analysis of a relaxed system, I.e. no input signal. There exists a unique positive definite $P$ for any given positive definite $Q$ if and only if the system $\dot{x}=Ax$ is globally asymptotically stable. This means we can make $\dot{V}$ arbitrarily small where $V$ is the quadratic Lyapunov function $V(x)=x^T Px$.
On the other hand, Riccati equation appears in LQR and LQE problems. The first one is used to find the optimal regulator that minimizes quadratic cost function. The second one is used to estimate the state variables from the output when there is measurement noise. First problem deals with input and second deals with output. This is why the extra term appears.
These two problems are dual and convertible to each other. Together these problems makes LQG problem.