We study "square" potentials, or piece-wise constant potentials, because they may crudely approximate real potentials.  Let us concentrate on one-dimensional "square" potentials.  Assume U(x) = U = constant in certain regions of space.  In such regions the time-independent Schroedinger equation,  HΦ(x) = EΦ(x,) can be written as

2Φ(x)/∂x2 + (2m(E - U)/ħ2)Φ(x) = 0.

We find the eigenfunction of H by solving HΦE(x) = EΦE(x).
We can solve this equation in regions of piecewise constant potentials.

Let E > U:
Then ∂2Φ(x)/∂x2 + k2Φ(x) = 0,   k2 = 2m(E - U)/ħ2.
The most general solution is Φ(x)  = Aeikx + A'e-ikx, with A and A’ complex constants.

Let E < U:
Then ∂2Φ(x)/∂x2 - ρ2Φ(x) = 0,   ρ2 = 2m(U - E)/ħ2.
The most general solution is Φ(x) = Beiρx + B'e-iρx, with B and B’ complex constants.
Note: A solution exists in the classically forbidden region.

Let E = U:
2Φ(x)/∂x2 = 0
The most general solution is  Φ(x) = Cx + C', with C and C’ complex constants.

How does the wave function behave at a point x = x1 where U is discontinuous, i.e. at a step?
(a)  Assume U has a step at x = x1. Assume U ≠ ±∞ on either side of the step.

Approximate U(x) by Uε(x), which is equal to U(x) everywhere except in a small region x1 ± ε, where it does not have the step but varies continuously.  We can write the Schroedinger equation as a difference equation,
∂Φε(x1 + ε)/∂x + ∂Φε(x1 - ε)/∂x = (2m/ħ2)∫x1-εx1+ε (Uε(x) - E) Φ(x) dx
As ε --> 0, Uε(x) remains finite, and therefore the integral remains finite and decreases as ε decreases.  For ε = 0 the integral is zero.  Therefore ∂Φε/∂x|ε-->0 is continuous.
At a finite step the boundary conditions are that Φ(x) and ∂Φ(x)/∂x are continuous.

(b)  Assume U(x) does not remain finite on one side of the step.
Approximate U(x) by Uε(x) such that Uε(x) has a step ∆U over a small interval 2ε = 2c/∆U.
As ε --> 0, ∆U --> ∞, and  ∫x1-εx1+ε (Uε(x) - E) Φ(x) dx  ≈ Φ(x1)[c - 2εE]  --> cΦ(x1).

At an infinite step ∂Φε/∂x|ε-->0 is discontinuous, but it has a finite discontinuity.  Therefore Φ(x) remains continuous as  ε --> 0.
In a region of finite width ∆x, where |U| is infinite, the wave function must be zero everywhere.  Since the wave function is continuous, it also must be zero also at the boundary in the adjacent region.  If |U| is infinite in a region with width ∆x = 0 (a δ-function, for example), the wave function can be finite there.  It will have the same value at the boundaries of the two adjacent regions and its derivative with respect to x will be discontinuous.