Both Can - but
Either could cause the pain you describe as well as could lifting heavy objects
, coughing a lot, or any number of things.
You don't say if the pain is constant, has lasted minutes or months, is disabling, etc. So it is not possible to tell you for sure what the issue is. If you are greatly concerned, you need to have it checked out unless it was just one or 2 small twinges that have passed.