There is no solution that would work in all cases, show us the code.
The problem is that when you put the code into one function and switch a little part of the behaviour somewhere inside, you raise the code complexity, and sometimes it’s better to keep some duplicated code than that.
Almost the same argument works for inheritance. You can easily stuff the common code into a common ancestor class, but if you start routinely use inheritance as a code-reuse tool, your design may slip into a world of pain. Inheritance means that code in one piece of code can affect behaviour in other pieces of code and before you know it, you will have an interlinked ball of code that’s almost impossible to change without breaking.
It’s usually best when you can extract or abstract some meaningful common part of the code from those three functions. Something that makes sense, like a high-level pattern, instead of just a few common lines that do no coherent work. A simple rule that may help you is naming the extracted code: Is there an obvious, natural way to name the chunk? Does it obviously fit into one of your classes? If it does, it might be a good solution. If you have hard time naming it and it could go pretty much anywhere, you might want to think a bit more.