diff --git a/gpu/command_buffer/client/transfer_buffer_cmd_copy_helpers_unittest.cc b/gpu/command_buffer/client/transfer_buffer_cmd_copy_helpers_unittest.cc
index bf38d993bfc79..010dd4e4f5a90 100644
--- a/gpu/command_buffer/client/transfer_buffer_cmd_copy_helpers_unittest.cc
+++ b/gpu/command_buffer/client/transfer_buffer_cmd_copy_helpers_unittest.cc
@@ -4,6 +4,7 @@
 
 #include "gpu/command_buffer/client/transfer_buffer_cmd_copy_helpers.h"
 
+#include "base/containers/span.h"
 #include "base/compiler_specific.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -25,7 +26,7 @@ class FakeScopedTransferBufferPtr {
   void Release() { buffer_.clear(); }
   uint32_t size() const { return static_cast<uint32_t>(buffer_.size()); }
   bool valid() const { return valid_; }
-  void* address() { return buffer_.data(); }
+  base::span<void> address() { return buffer_; }
 
  private:
   bool valid_;
@@ -72,13 +73,13 @@ class TransferBufferCmdCopyHelpersTest : public testing::Test {
     FakeScopedTransferBufferPtr transfer_buffer(BufferSize);
     ExpectedBuffers expected(count);
 
-    UNSAFE_TODO(EXPECT_TRUE(::internal::TransferArraysAndExecute(
+    EXPECT_TRUE(::internal::TransferArraysAndExecute(
         count, &transfer_buffer,
         [&](std::array<uint32_t, 4>& byte_offsets, uint32_t copy_offset,
             uint32_t copy_count) {
           // Check that each sub-copy is correct
-          const uint8_t* buffer =
-              reinterpret_cast<uint8_t*>(transfer_buffer.address());
+          base::span<const uint8_t>buffer =
+              base::as_writable_byte_span(transfer_buffer.address());
           EXPECT_EQ(memcmp(&buffer[byte_offsets[0]], &expected.a[copy_offset],
                            copy_count * sizeof(char)),
                     0);
diff --git a/url/url_canon_etc.cc b/url/url_canon_etc.cc
index 953d86a06e415..0d0c8493349e9 100644
--- a/url/url_canon_etc.cc
+++ b/url/url_canon_etc.cc
@@ -9,6 +9,7 @@
 
 #include <string.h>
 
+#include "base/containers/span.h"
 #include "url/third_party/mozilla/url_parse.h"
 #include "url/url_canon.h"
 #include "url/url_canon_internal.h"
@@ -27,7 +28,7 @@ inline bool IsRemovableURLWhitespace(int ch) {
 // It sucks that we have to do this, since this takes about 13% of the total URL
 // canonicalization time.
 template <typename CHAR>
-const CHAR* DoRemoveURLWhitespace(const CHAR* input,
+const CHAR* DoRemoveURLWhitespace(base::span<const CHAR>input,
                                   int input_len,
                                   CanonOutputT<CHAR>* buffer,
                                   int* output_len,
@@ -36,19 +37,8 @@ const CHAR* DoRemoveURLWhitespace(const CHAR* input,
   // case, so we want it to be fast and don't care about impacting the speed
   // when we do find whitespace.
   bool found_whitespace = false;
-  if (sizeof(*input) == 1 && input_len >= kMinimumLengthForSIMD) {
-    // For large strings, memchr is much faster than any scalar code we can
-    // write, even if we need to run it three times. (If this turns out to still
-    // be a bottleneck, we could write our own vector code, but given that
-    // memchr is so fast, it's unlikely to be relevant.)
-    found_whitespace = UNSAFE_TODO(memchr(input, '\n', input_len)) != nullptr ||
-                       UNSAFE_TODO(memchr(input, '\r', input_len)) != nullptr ||
-                       UNSAFE_TODO(memchr(input, '\t', input_len)) != nullptr;
-  } else {
-    for (int i = 0; i < input_len; i++) {
-      if (!IsRemovableURLWhitespace(UNSAFE_TODO(input[i]))) {
-        continue;
-      }
+  for (int i = 0; i < input_len; i++) {
+    if (IsRemovableURLWhitespace(input[i])) {
       found_whitespace = true;
       break;
     }
@@ -58,7 +48,7 @@ const CHAR* DoRemoveURLWhitespace(const CHAR* input,
     // Didn't find any whitespace, we don't need to do anything. We can just
     // return the input as the output.
     *output_len = input_len;
-    return input;
+    return input.data();
   }
 
   // Skip whitespace removal for `data:` URLs.
@@ -66,20 +56,20 @@ const CHAR* DoRemoveURLWhitespace(const CHAR* input,
   // TODO(mkwst): Ideally, this would use something like `base::StartsWith`, but
   // that turns out to be difficult to do correctly given this function's
   // character type templating.
-  if (input_len > 5 && input[0] == 'd' && UNSAFE_TODO(input[1]) == 'a' &&
-      UNSAFE_TODO(input[2]) == 't' && UNSAFE_TODO(input[3]) == 'a' &&
-      UNSAFE_TODO(input[4]) == ':') {
+  if (input_len > 5 && input[0] == 'd' && input[1] == 'a' &&
+      input[2] == 't' && input[3] == 'a' &&
+      input[4] == ':') {
     *output_len = input_len;
-    return input;
+    return input.data();
   }
 
   // Remove the whitespace into the new buffer and return it.
   for (int i = 0; i < input_len; i++) {
-    if (!IsRemovableURLWhitespace(UNSAFE_TODO(input[i]))) {
-      if (potentially_dangling_markup && UNSAFE_TODO(input[i]) == 0x3C) {
+    if (!IsRemovableURLWhitespace(input[i])) {
+      if (potentially_dangling_markup && input[i] == 0x3C) {
         *potentially_dangling_markup = true;
       }
-      buffer->push_back(UNSAFE_TODO(input[i]));
+      buffer->push_back(input[i]);
     }
   }
   *output_len = buffer->length();
@@ -332,21 +322,25 @@ void DoCanonicalizeRef(std::optional<std::basic_string_view<CHAR>> input,
 
 }  // namespace
 
-const char* RemoveURLWhitespace(const char* input,
-                                int input_len,
-                                CanonOutputT<char>* buffer,
-                                int* output_len,
-                                bool* potentially_dangling_markup) {
-  return DoRemoveURLWhitespace(input, input_len, buffer, output_len,
+UNSAFE_BUFFER_USAGE const char* RemoveURLWhitespace(
+    const char* input,
+    int input_len,
+    CanonOutputT<char>* buffer,
+    int* output_len,
+    bool* potentially_dangling_markup) {
+  return DoRemoveURLWhitespace(base::span(input, static_cast<size_t>(input_len)),
+                               input_len, buffer, output_len,
                                potentially_dangling_markup);
 }
 
-const char16_t* RemoveURLWhitespace(const char16_t* input,
-                                    int input_len,
-                                    CanonOutputT<char16_t>* buffer,
-                                    int* output_len,
-                                    bool* potentially_dangling_markup) {
-  return DoRemoveURLWhitespace(input, input_len, buffer, output_len,
+UNSAFE_BUFFER_USAGE const char16_t* RemoveURLWhitespace(
+    const char16_t* input,
+    int input_len,
+    CanonOutputT<char16_t>* buffer,
+    int* output_len,
+    bool* potentially_dangling_markup) {
+  return DoRemoveURLWhitespace(base::span(input, static_cast<size_t>(input_len)),
+                               input_len, buffer, output_len,
                                potentially_dangling_markup);
 }
 
