In this paper, we study theoretically the emergence of localized states of vegetation close to the onset of desertification. These states are formed through the locking of vegetation fronts, connecting a uniform vegetation state with a bare soil state, which occurs nearby the Maxwell point of the system. To study these structures we consider a universal model of vegetation dynamics in drylands, which has been obtained as the normal form for different vegetation models. Close to the Maxwell point localized gaps and spots of vegetation exist and undergo collapsed snaking. The presence of gaps strongly suggest that the ecosystem may undergo a recovering process. In contrast, the presence of spots may indicate that the ecosystem is close to desertification.