5. Given the planar region $D$ consists of all points on the boundary and inside of $\triangle A B C$, and $A(1,5)$, $B(1,1)$, $C(4,3)$. For the function $w=m x+y(m>0)$, if there are infinitely many points $(x, y) \in D$ such that $w$ attains its maximum value, then the value of $m$ is ( ).
(A) $\frac{3}{2}$
(B) $\frac{2}{3}$
(C) 1
(D) uncertain
5.B.

From $w=m x+y$ we get
$$
y=-m x+w \text {. }
$$

Equation (1) represents a family of parallel lines with a slope of $-m$, and $w$ is the intercept on the $y$-axis. According to the problem, when $y=-m x+u$ coincides with line $A C$, there are infinitely many points that make $u$ reach its maximum value. Therefore,
$$
-m=k_{4 C}=\frac{5-3}{1-4}=-\frac{2}{3} \text {. }
$$