Continue as new when reaching 5 000 events limit

Just to add, here are some polling best practices, your case i think would fall under “infrequent polling”.

Even tho the limit is 50K, it’s best practice to not let your workflow histories get super large as that could introduce possible latencies.
One idea would be to call continueAsNew as you mentioned, you could also look at using child workflows to partition the history, as each child workflow invocation would have its own history (and own 50K limit).
ContinueAsNew would be fine and if you implement polling via activity retries as mentioned in the link, you could call it after X number of performed activities for example.