MWD is measurement while drilling. It records values like
direction, inclination, toolface etc, which all are values needed
to achieve a successful drilling.
LWD is logging while drilling. It records logs (which generally
are run by wireline, after drilling). Most common being gamma and
resistivity logs. It gives us real time log data which helps to
geosteer.
In BHA, the arrangement is like... [ BIT - RSS* - MWD* - LWD* ]
(* - optional)