Both are general purpose engines and can be put towards a wide variety of game genres. Out of the box, UE4's editor comes with about half a dozen templates (FPS, top-down, side-scrolling platformer etc) for rudimentary intro projects.
Unreal Engine is somewhat harder to use, but it's graphics engine is a bit closer to the cutting edge - it's the go-to engine for AAA devs these days. Unity's main user base (for people who use it to make games - some use it for academic ends, or for tech demos) tends to be the indie game scene.
They do the same job, but differ in the technical aspects and ease-of-use, and business model (though both are aiming to lower the barriers to making games), and they tend to cater to different segments of the market.