When speaking, can you say:
I was there 2,3 years ago.
I was there 2 to 3 years ago.
Are both okay?
When we speak, we don't necessarily use grammatical formations. On that basis, you will hear "I was there 2 ... 3 years ago". The word "or" or "to" has been omitted. It might suggest that the person started off thinking they were there two years ago but then realised it was probably closer to three years ago. They might change their mind halfway through. They might simply be giving a ballpark figure. In writing and in any exam or formal situation, "I was there 2, 3 years ago" would be considered ungrammatical.
Remember - if you don't use correct capitalisation, punctuation and spacing, anything you write will be incorrect.