Staking and lending are both non-custodial. You are always in complete control of your private keys and funds throughout the staking and lending processes. You are free to undelegate or withdraw your funds at any time, subject to the lock-up requirements for each protocol.