A free defender behind the line
The sweeper operated behind the main defensive line, unattached to a specific marking assignment, free to read the game and cover whichever gap opened as an attack developed. For decades this was regarded as one of the most demanding and prestigious positions on the pitch, requiring exceptional reading of the game rather than raw pace or strength, since the role's entire value depended on anticipating danger before it materialised rather than reacting to an assigned opponent directly in front of the player.
Why the offside law made it less necessary
As interpretations of the offside law evolved to favour attacking play, and as defensive tactics shifted toward a coordinated back line moving up and down together to catch attackers offside, the value of a single free defender covering behind the line diminished considerably. A well-organised back four moving as a unit could achieve much of what a sweeper once provided individually, but at lower risk, since it did not depend on one player's judgement alone and instead distributed defensive responsibility across several coordinated players acting together.
What replaced it
The functional descendant of the sweeper today is arguably the ball-playing centre-back who steps forward to intercept play or the goalkeeper comfortable acting as an extra defender outside the penalty area, both of which distribute the sweeper's old responsibilities across different roles rather than concentrating them in one. The position has not vanished from football so much as been broken apart and redistributed, which is a pattern worth noticing whenever a once-prestigious role appears to disappear: often its functions persist, just spread across positions with different names.

