A little-discussed provision in the Senate tax bill could lead to a higher tax bill for millions of individual investors and cause many to unload stocks before year-end to avoid those costs.

Under the Senate’s $1.4 trillion tax overhaul, investors would lose the ability to choose which shares they can sell to reduce a position. Instead, investors selling partial stakes in a company would have to unload their oldest shares first, a process known as selling on a “first-in, first-out” basis.

Selling...