iPhone trouble

I have a iPhone X and it does things by itself. Even if I sit it on the table and not touch it. It’ll open apps by itself, like pictures on IG by itself and sometimes freeze up. It’s annoying as hell. Has this happened to anyone else? If so, did they give you another one to replace it?