That should be fine. As long as the records relating to email match up in both directions, you can have other DNS records pointing to different IP addresses all you want.
For instance quite a common scenario would be to have inbound email delivered to mail.sub.domain.tld on one IP address, and a website hosted on a different server/IP address pointing to www.sub.domain.tld and sub.domain.tld.
Obviously if you're sending from the mail.sub.domain.tld IP(s), and also have the website sending emails (for instance contact forms), then you'd need to ensure that both of them are included in your SPF record, so receiving servers see both as valid email sources.
The same is true for domain.tld, as you'd have separate MX / A / SPF records for that domain level, so they wouldn't impact each other. For instance mail.sub.domain.tld and mail.domain.tld could have completely different setups and DNS records without negatively interacting with each other.
If a receiving server got an email from name@sub.domain.tld it will specifically look in sub.domain.tld for an SPF record, not in the root domain.tld domain that could be configured with completely different details.