Here is a solution for $n=2d^2-2$ with $|S|=4d-3.$ It is just Gerry Myerson's scheme with a very slight adjustment, so the same asymptotics. $0,1,\cdots d-1$ then $2d-1,3d-1,4d-1,\cdots ,(2d-2)d-1$ then $n-d+1,n-d+2,\cdots,n.$ Note that $n-d+1=(2d-1)d-1.$ Here are some of Rob Prats's reported values (which I have no reason to question) with $n=2d^2-2$ in bold. $|S|\ \ \ n$ $5\ \ \ \ \ \ 5,\mathbf{6}$ $9\ \ \ \ \ \ 14,15,\mathbf{16}$ $13\ \ \ \ \ \ 28,29,\mathbf{30},32$ $14\ \ \ \ \ \ 31,33,34,35,36$ $17\ \ \ \ \ \ 47,\mathbf{48},49,50$ and perhaps a few larger $n?$ It would make my construction look more optimal if $n=31$ required $|S|=14$ (which is the only case reported with $|S|=m(n) \lt m(n-1)$ ) and if $n=49,50$ required $|S|=18.$ I would be curious to see the optimal sets $|S|.$