# TeX, 86 bytes
The definition of the function is 86 bytes long and we need one byte per argument as a delimiter (I used a comma). The function's name is 2 bytes long, so calling it costs another 2 bytes, totalling 94 bytes plus the arguments.
An entire script defining the function (1st line) and applying it to the example arguments (2nd line). The `\bye` is included to end the `pdftex` interpreter (the output file is only written at the end).
Output in the PDF:
- saved 2 bytes by changing n to be 0-based.
# [APL (Dyalog Unicode)], 15 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?") ([SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set"))
Full program. Prompts for: `s` `n` `u` `t`
[Try it online!][TIO-k89zhyza]
`⍞` prompt for string `s`
`⊢` on that…
`⍠'ML'(`…`)` set the Match Limit to:
`⎕` prompt for number `n`
`-` negate it (meaning "only the Nth" rather than "the first N")
`⍞` prompt for string `u`
…`⎕R` replace the following with that:
`⍞` prompt for string `t`
[APL (Dyalog Unicode)]: https://www.dyalog.com/
[TIO-k89zhyza]: https://tio.run/##SyzI0U2pTMzJT///qKO94P@j3nmP@qYGgajeBeq@PuoaukC@5qOuRUAhkJL/CmBQwJXo6OScBMQpqWlAMpnLiMvF1Y0LyAQA "APL (Dyalog Unicode) – Try It Online"