Sam, son of former Bolton Wanderers and Everton defender Alan Stubbs, joined Boro's Academy from Wigan Athletic, having risen through the youth ranks at Goodison Park.
The defender made his Latics debut in an EFL Cup tie against Blackpool in the 2017/18 season, and had loan spells with Crewe Alexandra and AFC Fylde.
After playing three games for us in the Checkatrade (Football League) Trophy, Sam joined Notts County on loan late in January 2019 until the end of the season.
He went on to make 17 appearances for the Magpies, winning many plaudits for his attitude and performances, but was unable to prevent Notts County from falling out of the Football League for the first time in their history at the end of the 2018/19 season.
In August 2019, Sam linked up with Scottish Premiership outfit Hamilton Academical on a season-long loan.