Example 5 Find the range of $k$ such that the equation
$$
x^{2}-k x-k+3=0
$$

has two roots in the open intervals $(0,1)$ and $(1,2)$, respectively.
Solution: The original equation can be transformed into $x^{2}+3=k(x+1)$. Let $y_{1}=x^{2}+3, y_{2}=k(x+1)$.

Draw the graphs of $y_{1}$ and $y_{2}$, as shown in Figure 1. The intersection points of the parabola and the family of lines are on $\overparen{A B}$ and $\overparen{B C}$ (excluding points $A, B, C$) when the two roots of the equation are in the intervals $(0,1)$ and $(1,2)$. Thus, we have
$$
k_{D B}=2, k_{D C}=\frac{7}{3} .
$$

Clearly, $2<k<\frac{7}{3}$.