I have 2 Arduino programs that work separately. How can I merge them?
Instead of using a delay functions that holds everything up, configure or access a timer peripheral that keeps counting in the background regardless of what the Arduino is doing whose value can be checked whenever you need to.
For example: https://www.arduino.cc/reference/en/language/functions/time/millis/
That timer rolls over every 50 days so if you never plan on leaving your thing running that long, you can treat it as timer for absolute time. If you are running longer than 50 days then you have to add some extra if else checks for when the timer wraps around.
Then use two conditional statements for your two other functions in the loop to poll that timer to see whether they should be doing anything on that particular loop iteration. Those functions can record a value from the clock at events of significance and compare it against the current value to see if enough time has elapsed. You can use global variables for this, but static variables (if Arduino allows them) are safer since they are only visible within the function and retain their value between function calls. You also don't have timekeeping global variable floating around for every single function that are accessible to everything.
That way, if the Arduino isn't supposed to be doing anything at that particular time for that particular action, it can go on and do something else instead of twiddling its thumbs waiting around and holding everything after that up. Pretty much never use a delay function that just holds the processor preventing it from doing anything else if you can. Toss that delay() in the trash where it belongs 99% of the time.
Welcome to the world of multi-tasking!