Would it be safe to use Ubuntu on an unsupported Mac?
This should be fine.

A mid-2009 MBP won't be seeing any firmware updates from Apple.

If you ever found some reason you needed to run macOS on the machine, you can boot from a USB stick. Consider prepping that USB stick before you switch to Ubuntu.

Linux can definitely help breath new life into an older Macbook. You may want to consider a lighter-weight desktop environment or window mananger to maximize that benefit, though.