There are different types of scan matching algorithms to match consecutive 2D lidar scans, see https://youtu.be/nvFcN2-NqRc?t=421 (ICP, correlative matching, RANSAC). Most of the algorithms return the estimated robot pose as a result. From the intuition, if we can match the data points, we shall extract the points that don't match. These outliers after the scan matching can be the dynamic objects which can be filtered again.
Update: My concrete question, during a robot motion, how can I extract the unmatched measurement points from two consecutive lidar scan, after a scan-matching pre-processing? This question is of course depends on the utilized scan-matching algorithm.