OpenGL and DirectX are low level APIs that give you indirect access to the GPU and allow you to draw things to the screen using hardware.
SFML has 5 modules: system, window, audio, networking, and graphics. The graphics module uses OpenGL to draw things, and the window module creates an OpenGL context. The other 3 modules, as far as I know, do not use OpenGL.
So to answer the second part of your question - SFML and SDL are not substitutes for OpenGL/DirectX - they do provide a set of functions/classes that wrap OpenGL to try to make it a bit easier to use. You can, with both SFML and SDL, use your own OpenGL code in conjunction with theirs and their documentation shows exactly how to do this.
You cannot use Direct3D with SFML/SDL - though you could probably use it with SFML if you only use the audio, networking, and system modules.
EDIT: Also - SFML is a good framework to use if your wanting to learn to build your own engine in my opinion. It will take care of a lot of details to get you up and running - and as you learn you can disable modules replacing them with your own code if you would like - or with other libraries specific for the task at hand. For example - you could start with having SFML load your images from file, then later change that out with stb_image or devIL if you like.