I made this app! Built it for myself and my partner because I had exactly the same problem — every other medication app seems to be built for taking something on a regular schedule.
Not sure if it’s very user-friendly, but it works well for me. There also isn’t an option for more complex rules (just max X doses every Y hours), so you’ll need to set something up that makes sense.