How to rewrite the post slug of a custom post type post

It looks as though you are accidentally including -meaning inside your second match string. Instead of this:

^words/([^/]+)(?:/([0-9]+)-meaning)?/?$

… try this:

^words/([^/]+)(?:/([0-9]+))-meaning?/?$

And don’t forget to flush your permalinks after a change to the rules!