Like others are saying, it's probably not a phone bug but a carrier limitation (or, don't get mad, user error). So, things you can try.
1) Call your carrier. Make sure your plan/line has international texting capabilities and isn't restricted in any way. For instance, basic Google Voice numbers can receive texts from anywhere, but when it comes to replying, you can only text back to US/Canada numbers.
2) Try using a 3rd party messaging app. This would help determine if there's maybe something wrong with the stock app or how it is trying to configure texting. I'd try Textra since it's a popular option and you can try it out for free.
3) Check the number. Make sure the country code is included, and this is where it sucks for some countries, make sure that the phone you want to reach doesn't require special dialing for mobile phones. For instance, when receiving a call/text from a Mexican mobile phone, most carriers will display country code and number, but try to text back or call that number (as displayed) and you'll get an error message. Why? In order to call or text Mexican mobile numbers you need to add a 1 between the country code and the actual phone number.
4) Try your SIM in a different phone. Does the message go through then? If so, then this IS an issue with the phone (still most likely related to the carrier, but at least you'd know if it's a phone-specific issue with the carrier).
Hope it helps.