If your function does not take a bufnr as parameter and if there is no alternative function that does, you'll need to jump to that particular buffer and call your function.
The caveat? It'll trigger autocommands, which means stuff you may not desire is likely to happen. EDIT: I didn't know about
noautocmd which prevents autocommands from being triggered when loading other buffers momentarily. See @Karl Yngve Lervåg's answer.
In your particular case though, it seems that
line2byte(lnum+1) is almost identical to
eval(join(map(getbufline(bufnr, 1, lnum), 'strlen(v:val)'), '+'))+lnum+1.
If the line ending is not unix, the offset may be
&ff =='unix' ? lnum+1 : 2*lnum+2 -- I haven't checked dos case, nor mixed line endings.
Regarding the second question: "how to emulate
byte2line()?", it can be done this way:
function! bufbyte2line(bufid, byteidx) abort
let lines = map(getbufline(a:bufid, 1, '$'), 'v:val."\n"')
let line_lengths = map(lines, 'len(v:val)')
let acc = 
call map(line_lengths, 'add(acc, acc[-1]+v:val)')
return len(filter(acc, 'v:val <= a:byteidx'))