You’ve encountered Quicksand Moss! It should be fairly easy to escape from, though you might experience lingering pain or swelling in your leg.
Quicksand Moss - Quicksand moss has the appearance of dead moss, although in reality, this brown colour is due to it consuming animals instead of sunlight. It grows anywhere a regular moss or lichen would, but grabs any creature foolish enough to come near and quickly digests them.