A transaction is dependent on all transactions whose outputs are spent, and it can only be confirmed after all its ancestors are confirmed (this can be within the same block, just in the correct order). This has a few implications:
- If a transaction is replaced or double-spent, all its descendants become invalid, because they are now spending non-existent inputs.
- If a descendant transaction pays a higher fee than its ancestor, this creates an incentive for miners to confirm both (this is called Child Pays For Parent or CPFP).
You can attach a dependent transaction to a transaction as long as you are the recipient of one of its outputs. If the transaction contains a change output, this also includes the sender. Depending on a transaction has no impact other than potentially incentivizing miners to confirm it faster.