You can indeed, but you can't just dive in.
Just like with a human, it takes proper training and stretching to widen their tailhole. Months of it, just a little bit each day. Over time it will gradually stretch wider.
And of course when you mess around under the tail, it will get messy. Have sex after they shit, or use an enema and wash it out, will be OK. If you don't mind washing your cock off, then go ahead in.
Don't recommend condoms, as it takes the sensation away, and in some cases you can't feel where your penis is going and you could hit the wrong area and hurt them.
Females tend to have more relaxed tailholes than the males, so if you're looking for gape, then try with a female.
Anyone that says it hurts them is likely a moron that hurt the dog via their own actions and lack of self control.