3M Co. shares rallied after hours Thursday after the company said it would pay $10.3 billion to settle “forever chemicals” claims.