Boundary condition vary

Hello, how can you vary the boundary conditions? Previously, I used the UnitIntervalMesh function which has an interval of [0,1]. Is it possible to somehow make the interval be for example [0,5]?

I do not think the topic title is matching your question.
You are asking how you can vary the computational domain of your problem, morphing
\Omega=[0,1] to \hat\Omega=T(\Omega)=[0,5].
In legacy DOLFIN, this can be done by using the ALE.move command, see for instance: How to use ALE for moving boundary problems? - #2 by dokken