Looking at the comments on the question, it looks like the obvious solution is to use the hooks hook_node_insert()
and hook_node_update()
.
I actually just did something very similar as described in the answer: I wrote a function that does what I want to be done every time a node is created/updated and then call it from each of those hooks. It works just fine.