If my particle is an electron, how do I create a square well potential (in one dimension) in practice? I would like to know how to actually achieve it. Is it like at both the ends, I need to put some bunch of electrons to repel the electron in the middle or something like that?
Square wells are fundamentally discontinuous and un-physical potentials. They're meant as toys to visualize behavior, so there's no good way to physically construct them. However, some reasonably similar situations can be made, though I'm not sure why you'd want to do that.
For an electron, you could, for instance, take 2 capacitor plates, such that the field is zero outside and some constant value inside., like this:
But if you look closer, you'll see that there need to be some charges deposited at finite distances from each other on each of those surfaces, and it'll be something like this:
And around each of those charges there's a nice, continuous field, and only once you add all those individual fields will you get those equipotential surfaces parallel to the walls of the well.
Square well potentials are analytically convenient in educational demonstrations of quantum mechanics. In practice one zero dimensional realisation is the so called quantum dot, which is applied in QLED screens. Another is the Penning trap. A realisation of a 1D quantum well is called a quantum wire. An example is the carbon nanotube.