二(èr)is used for counting.

 一 二 三……(numeral)
yī èr sān

第一,第二,第三……(ordinal number)

dìyī, dìèr dìsān

两(liǎng),as an initial number for 2,has to be used if a measure word follows it.

2 people 两个人 liǎnggè rén

2 o’clock 两点 liángdiǎn

2 dollars 两美元 liángměiyuán