Can I distribute a custom function in a pack?

If so, is that function available to pipelines outside of the pack or can I only use it in pipelines within the pack?

Yes, custom functions can exist in a pack. The function is available if you send events through the pack. You can also use custom functions outside of a pack if you need access to it.