A house is separate from other houses - it might share a wall with the house next to it, but it has its own front door.
In the US an apartment is one of several homes which are in a large building, with a shared entrance. The building is called an apartment building. An apartment can have more than one floor - if it has two it is called a duplex apartment. Simple.
In the UK we would describe the building as a block of flats. A flat has only one floor - it is actually flat. If it has multiple floors it is called a maisonette.
US English terms are increasingly used in the UK, so the many developments of investment properties in London usually describe themselves as apartments - this is perhaps to make them seem worth £10m each - and the buildings are described as apartment blocks.
While we are at it, in England a tower block is a block of council flats - this is a form of social housing. A mansion block is a block of mansion flats - these are posh flats built mainly in Edwardian times.