Former President Barack Obama could run for, and serve as, Vice President of the United States.
The Founding Fathers placed no limits in the U.S. Constitution regarding how many times any one person could be elected (or otherwise serve) as President of the United States. However, in 1947 (after Franklin D. Roosevelt had broken with tradition and the Democrats won five consecutive presidential elections), Congress passed the 22nd amendment, ratified by the requisite number of states in 1951, which created a two-term limit for future Presidents. That amendment (along with earlier constitutional restrictions) would seem to disqualify Barack Obama from ever again attaining the office of President or Vice President of the United States, as he was elected to, and served, two full terms in that office between 2009 and 2017.
However, the wording of the 22nd Amendment doesn’t literally say that no one can be President for more than two terms; only that no one can be elected President more than twice:
No person shall be elected to the office of the President more than twice, and no person who has held the office of President, or acted as President, for more than two years of a term to which some other person was elected President shall be elected to the office of the President more than once.
Presumably this still leaves open the loophole (intended or not) that one who had already been elected twice could still serve as President again by attaining that office through other means — particularly, by being elected or appointed Vice-President and thus becoming next in the line of presidential succession when the sitting President dies, becomes incapacitated, or resigns:
But does that loophole really exist? Some maintain it doesn’t because the 12th Amendment (ratified in 1804 to fix some unexpected issues with the originally specified methods for selecting the President and Vice-President) states that “no person constitutionally ineligible to the office of President shall be eligible to that of Vice-President of the United States.” So, one who has already twice been elected President isn’t eligible to become Vice-President afterwards and thereby potentially sneak into the presidency again through the back door.
Again we bump into some problems of literalness, though, because some would argue that a person who has already run up against the limits of the 22nd Amendment isn’t “constitutionally ineligible” to be President (i.e., that person doesn’t fail to meet one or more of the requirements specified in Article II of the constitution, such as being at least 35 years old or a natural-born citizen of the United States) but is merely constitutionally ineligible to be elected President. Under this interpretation, a former two-term President would still be eligible, under the law, to obtain and hold the office of Vice President through election or appointment to that position.
Ultimately, the only answer to this hypothetical is that there is no answer: this is an interpretive legal issue that, should it ever arise, would have to be decided by the judicial branch of the U.S. government.