As of 2020, all Major League teams need to designate every player on the active roster as either a pitcher or a position player. The number of pitchers a club may carry on the active roster will be capped (maximum number TBD).
Only players designated as pitchers are allowed to pitch in a game, including in the postseason, with three exceptions.
1) The game goes into extra innings.
2) The player's team is winning or losing by six or more runs.
3) The player has earned the "two-way" designation.
To qualify for the two-way designation, a player must pitch 20 Major League innings and have 20 games played as a position player or designated hitter, with at least three plate appearances in each of those 20 games, in either the current or previous MLB season.
Once a player has earned the two-way player designation, he maintains that status for the rest of that season and the following season. And while he has that status, his team no longer has to use one of its pitching roster spots on him.
Players aren't able to switch from pitcher to position player during an ongoing season, but they could switch from pitcher to two-way player during the season once they have met the necessary requirements.