In the paper, we solve two Stefan problems. The first problem recovers an unknown moving boundary by specifying the Cauchy boundary conditions on a fixed left-end. The second problem finds a time-dependent heat flux on the left-end, such that a desired moving boundary can be achieved. Then, we solve an inverse Cauchy-Stefan problem, using the over-specified Cauchy boundary conditions on a given moving boundary to recover the solution. Resorting on a homogenization function method, we recast these problems into the ones having homogeneous boundary and initial conditions. Consequently, the approximate solution is obtained by solving a linear system obtained from the collocation method in a reduced domain. For the first Stefan problem the moving boundary can be determined accurately, after solving a nonlinear equation at each discretized time. For the second Stefan problem, we can obtain the required boundary heat flux without needing of iteration. Numerical examples, including non-smooth ones, confirm that the novel methods are simple and robust against large noise. Moreover, the Stefan and inverse Cauchy-Stefan problems are solved without initial conditions.