You were refused entry and had your passport stamped accordingly. You then entered Britain via Ireland, without encountering UK immigration. Immediately, your status is suspect, but after three years there is no question: you are in Britain illegally. There is no way you could not have known this, and nobody in the UK authorities will believe it is a mistake.
If you come to the attention of UK Immigration now they'll probably have you on a plane so fast your feet won't touch the ground. Alternatively, they'll put you in an immigration detention centre until they can put you on a plane. That's not an experience you will enjoy.
You should, therefore, arrange to leave the UK as soon as possible. Since your departure will be notified to UK Immigration by the airline you can assume that your illegal presence will be on record and you will find it difficult, if not impossible, to return. You should arrange your affairs in the UK accordingly.
(Thanks to various contributors whose comments were used to compile this answer)