Find the Cell's Neighbours
JavaScript (ES6), 75 bytes
Saved 2 bytes thanks to @KevinCruijssen
Expects a 0-based index.

(h,w,i)=&gt;[...'12221000'].map((k,j,a)=&gt;(i+w+~-k)%w+~~(i/w+h+~-a[j+2&amp;7])%h*w)

Try it online!
The surrounding indices are returned in the following order:
$$\begin{matrix}5&amp;4&amp;3\\6&amp;\cdot&amp;2\\7&amp;0&amp;1\end{matrix}$$
How?
The indices \$I_{dx,dy}\$ of each surrounding cell at \$(x+dx,y+dy)\$ are given by:
$$\begin{align}I_{dx,dy}&amp;=((x+dx) \bmod w)+w((y+dy) \bmod h)\\&amp;=((N+dx) \bmod w)+w((\left\lfloor\frac{N}{w}\right\rfloor+dy) \bmod h)\end{align}$$
where \$N=wy+x\$ is the index of the target cell.
We walk through the list \$[1,2,2,2,1,0,0,0]\$ and subtract \$1\$ to get the value of \$dx\$, which gives:
$$[0,1,1,1,0,-1,-1,-1]$$
For the corresponding values of \$dy\$, we use the same list shifted by 2 positions, which gives:
$$[1,1,0,-1,-1,-1,0,1]$$